aylei / leetcode-rust Goto Github PK
View Code? Open in Web Editor NEWmy leetcode solutions in rust
License: Apache License 2.0
my leetcode solutions in rust
License: Apache License 2.0
Hi,
Out of interest, I read one of your solution s0007.
I was given the impression from problem desc that a solution would be like
str.push('-');
str[1..].chars().rev().collect::<String>().parse().unwrap_or(0)
Your code is much like c than rust.
我改了下代码输出接口获取的problem,发现id和slug并不匹配:
cargo run 179
Compiling leetcode-rust v0.1.0 (/Users/daniel/CLionProjects/leetcode-rust)
Finished dev [unoptimized + debuginfo] target(s) in 3.86s
Running `target/debug/leetcode-rust 179`
id: 1057, code: rust, slug: numbers-with-repeated-digits
id: 1056, code: rust, slug: capacity-to-ship-packages-within-d-days
id: 1055, code: rust, slug: pairs-of-songs-with-total-durations-divisible-by-60
id: 1054, code: rust, slug: complement-of-base-10-integer
id: 1050, code: rust, slug: construct-binary-search-tree-from-preorder-traversal
id: 1049, code: rust, slug: minimum-domino-rotations-for-equal-row
id: 1048, code: rust, slug: clumsy-factorial
id: 1047, code: rust, slug: maximize-sum-of-array-after-k-negations
id: 1046, code: rust, slug: max-consecutive-ones-iii
id: 1045, code: rust, slug: check-if-word-is-valid-after-substitutions
I've been looking online, and I can't find any documentation for it. Nice solutions btw.
如题,还是说leetcode上是可以这么做的[滑稽]?
Project fails to build with the current futures
version.
Compiling futures v0.3.4
error[E0432]: unresolved import `futures_core::core_reexport`
--> /Users/nskobelevs/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-0.3.4/src/lib.rs:542:9
|
542 | pub use futures_core::core_reexport;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ no `core_reexport` in the root
error[E0433]: failed to resolve: could not find `document_join_macro` in `futures_util`
--> /Users/nskobelevs/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-0.3.4/src/lib.rs:561:15
|
561 | futures_util::document_join_macro! {
| ^^^^^^^^^^^^^^^^^^^ could not find `document_join_macro` in `futures_util`
error[E0433]: failed to resolve: could not find `document_select_macro` in `futures_util`
--> /Users/nskobelevs/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-0.3.4/src/lib.rs:584:15
|
584 | futures_util::document_select_macro! {
| ^^^^^^^^^^^^^^^^^^^^^ could not find `document_select_macro` in `futures_util`
error[E0603]: module `async_await` is private
--> /Users/nskobelevs/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-0.3.4/src/lib.rs:547:23
|
547 | pub use futures_util::async_await;
| ^^^^^^^^^^^ private module
|
note: the module `async_await` is defined here
--> /Users/nskobelevs/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.21/src/lib.rs:34:1
|
34 | mod async_await;
| ^^^^^^^^^^^^^^^
This version has since been yanked - the next non yanked version is 0.3.11 which seems to work fine.
Currently, the problem manipulation tool is mixed with solutions, which is inflexible and cannot be easily used outside this project.
Build a standalone Cargo extension to do such stuffs will be more maintainable and usable.
The formula you gave seems incorrect to me. I know you said it's high school math, but I guess I forgot it.
It works, for the example, but I don't see how it could work for many other ones.
For example, say you have a 3x3 matrix. With your formula, it would be 3!/(3!*(3 - 3)!) = 1
. It seems to me like there would be more than one way to make it down in a 3 by 3 matrix. In fact, matrix with the same number of rows and columns would equal 1 with the formula n! / r!(n-r)!
.
Am I missing something here?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.