Skip to content

Fix rendering problem with a superscript bigger than 10 #39

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2021
Merged

Fix rendering problem with a superscript bigger than 10 #39

merged 2 commits into from
Jun 8, 2021

Conversation

heeh
Copy link
Contributor

@heeh heeh commented Jun 7, 2021

The issue #38 is caused by the code at helper.rs#L126

  1. superscript(n / 10).parse().unwrap_or(0) and superscript(n % 10).parse().unwrap_or(0) always fail.
  2. This happens because parse function does not know the output type. It fails and we get 0 instead of ³¹ as in leetcode pick: wrong constraints #38.
  3. Even if you use parse::<u32>(), parsing a superscript(e.g. ³ ) produces invalid digit error.

I believe that you want to concatenate two superscripts here.
This commit produces a valid representation.

ex) -2³¹ <= num <= 2³¹ - 1

@heeh
Copy link
Contributor Author

heeh commented Jun 7, 2021

This is #37.

You set up the rust toolchain correctly(https://github.com/clearloop/leetcode-cli/blob/master/rust-toolchain#L1)
However, the following workflows invoke rustc 1.54.0-nightly (35fff69d0 2021-06-06) instead of rustc 1.54.0-nightly (8cf990c9b 2021-05-15)

There are two possible fixes.

  1. Make workflow files explicitly use nightly-2021-05-16
  2. Fix cannot find type NoneError in module std::option #37

I committed the first fix.

@clearloop clearloop merged commit a03f7b0 into clearloop:master Jun 8, 2021
@clearloop
Copy link
Owner

Thanks!! @heeh! just published v0.3.7 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants