skygragon / leetcode-cli

A cli tool to enjoy leetcode!
MIT License
3.64k stars 457 forks source link

Number question #199

Open invokerw opened 4 years ago

invokerw commented 4 years ago

https://github.com/skygragon/leetcode-cli/blob/5245886992ceb64bfb322256b2bdc24184b36d76/lib/core.js#L92

return x.fid === keyword || x.name === keyword || x.slug === keyword;

Suggested to replace with return Number(x.fid) === keyword || x.name === keyword || x.slug === keyword;

I'm using this command "leetcode show 1" show Problem not found! because of this...

anyfeel commented 4 years ago

why @skygragon not accept this pr?

pinggit commented 4 years ago

I have no problem running "leetcode show 1"

|| [leetcode show 1]
|| [1] Two Sum  
|| 
|| https://leetcode.com/problems/two-sum/description/
|| 
|| * algorithms
|| * Easy (45.03%)
|| * Likes:    13338
|| * Dislikes: 487
|| * Total Accepted:    2.5M
|| * Total Submissions: 5.6M
|| * Testcase Example:  '[2,7,11,15]\n9'
|| 
|| Given an array of integers, return indices of the two numbers such that they add up to a specific target.
|| 
|| You may assume that each input would have exactly one solution, and you may not use the same element twice.
|| 
|| Example:
|| 
|| 
|| Given nums = [2, 7, 11, 15], target = 9,
|| 
|| Because nums[0] + nums[1] = 2 + 7 = 9,
|| return [0, 1].
|| 
|| 
|| [Finished in 2 seconds]
chxin commented 4 years ago

I have the same problem: command "leetcode show 1" but got errors: "Problem not found".

snippet from @wfatestaynight solves!

return Number(x.fid) === keyword || x.name === keyword || x.slug === keyword;