refactor: rename main.rs as lib.rs
This commit is contained in:
parent
75a12ace37
commit
50d62c34be
@ -1,6 +1,4 @@
|
||||
fn main() {}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn maximum69_number(num: i32) -> i32 {
|
@ -1,8 +1,4 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn hamming_weight(mut n: i32) -> i32 {
|
@ -1,8 +1,4 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn build_array(nums: Vec<i32>) -> Vec<i32> {
|
@ -1,10 +1,6 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn is_happy(mut n: i32) -> bool {
|
@ -1,9 +1,3 @@
|
||||
use std::ops::Deref;
|
||||
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
pub struct ListNode {
|
||||
pub val: i32,
|
||||
@ -17,7 +11,7 @@ impl ListNode {
|
||||
}
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn reverse_list(head: Option<Box<ListNode>>) -> Option<Box<ListNode>> {
|
@ -1,8 +1,4 @@
|
||||
fn main() {
|
||||
println!("{}", Solution::gcd(10, 25));
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
#[derive(PartialEq, Eq, Clone, Debug)]
|
||||
pub struct ListNode {
|
||||
@ -10,13 +6,6 @@ pub struct ListNode {
|
||||
pub next: Option<Box<ListNode>>,
|
||||
}
|
||||
|
||||
impl ListNode {
|
||||
#[inline]
|
||||
fn new(val: i32) -> Self {
|
||||
ListNode { next: None, val }
|
||||
}
|
||||
}
|
||||
|
||||
impl Solution {
|
||||
pub fn insert_greatest_common_divisors(
|
||||
mut head: Option<Box<ListNode>>,
|
@ -1,8 +1,4 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn difference_of_sums(n: i32, m: i32) -> i32 {
|
@ -1,8 +1,4 @@
|
||||
fn main() {
|
||||
println!("{}", Solution::score_of_string("hello".to_string()));
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn score_of_string(s: String) -> i32 {
|
@ -1,8 +1,4 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn is_power_of_four(mut n: i32) -> bool {
|
@ -1,12 +1,6 @@
|
||||
use std::cmp;
|
||||
|
||||
fn main() {
|
||||
let x = "000".to_string();
|
||||
let y = "0".to_string();
|
||||
println!("{}", Solution::plus(x, y));
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn multiply(x: String, y: String) -> String {
|
@ -1,8 +1,4 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn unique_paths(m: i32, n: i32) -> i32 {
|
@ -1,11 +1,4 @@
|
||||
fn main() {
|
||||
println!(
|
||||
"{}",
|
||||
Solution::unique_paths_with_obstacles(vec![vec![0], vec![1]])
|
||||
);
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn unique_paths_with_obstacles(obstacle_grid: Vec<Vec<i32>>) -> i32 {
|
@ -1,8 +1,4 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn min_path_sum(mut grid: Vec<Vec<i32>>) -> i32 {
|
@ -1,16 +1,10 @@
|
||||
fn main() {
|
||||
println!("{}", Solution::judge_point24(vec![1, 5, 9, 1]));
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn judge_point24(cards: Vec<i32>) -> bool {
|
||||
let mut stack: Vec<Vec<f64>> = vec![cards.iter().map(|&v| v as f64).collect()];
|
||||
|
||||
while let Some(cards) = stack.pop() {
|
||||
println!("{:?}", cards);
|
||||
|
||||
if cards.len() == 1 {
|
||||
if (cards.first().unwrap() - 24f64).abs() < 1e-6 {
|
||||
return true;
|
||||
@ -27,7 +21,6 @@ impl Solution {
|
||||
let mut left_cards = cards.clone();
|
||||
left_cards.remove(j);
|
||||
left_cards.remove(i);
|
||||
println!("{i} {j} {:?}", left_cards);
|
||||
|
||||
let mut new_cards = left_cards.clone();
|
||||
new_cards.push(a + b);
|
@ -1,8 +1,4 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn new21_game(n: i32, k: i32, max_pts: i32) -> f64 {
|
@ -1,11 +1,4 @@
|
||||
fn main() {
|
||||
println!(
|
||||
"{}",
|
||||
Solution::unique_paths_iii(vec![vec![1, 0, 0, 0], vec![0, 0, 0, 0], vec![0, 0, 2, -1]])
|
||||
);
|
||||
}
|
||||
|
||||
struct Solution;
|
||||
pub struct Solution;
|
||||
|
||||
impl Solution {
|
||||
pub fn unique_paths_iii(grid: Vec<Vec<i32>>) -> i32 {
|
Loading…
x
Reference in New Issue
Block a user