Giter VIP home page Giter VIP logo

leetcode-rust's Issues

Manipulating rust iterators

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.

leetcode的id和slug不匹配

我改了下代码输出接口获取的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

Outdated futures version

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.

62 does not seem right to me

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.