Leetcode notes Two (26, 20,9)

Source: Internet
Author: User

LeetCode26: Given an ordered sequence, the number of different elements is obtained and different sequences are returned, requiring the return in situ , O (1) space (+, Easy)

minutes, the first time on the AC slightly happy, the best record 406ms seems to be the former 1%! Although this time is not reliable

Nothing to optimize, feel almost no scrap code

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/58/BD/wKiom1S6QJjAMt4WAAC7m78ysZc152.jpg "title=" Leetcode26.png "style=" Float:none; "alt=" wkiom1s6qjjamt4waac7m78yszc152.jpg "/>

Experience? : Is there really a company test so simple?

parentheses match. (Easy)

It is best to record 430ms, before 10%. A little bit clever, but not good (using the exception to judge)

Experience 8: Using a Stack is much more efficient than using arrays, and for this problem

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/58/BB/wKioL1S6QWiAvquZAAHkiMDqfeA739.jpg "title=" Leetcode20.png "style=" Float:none; "alt=" wkiol1s6qwiavquzaahkimdqfea739.jpg "/>

Experience? : Is there really a company test so simple?

determine whether a number is a palindrome number, can not use extra space (this is strange, no extra space to run without the Loop) (9, Easy) (opportunistic method)

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/58/BD/wKiom1S6QJeBZd9DAADxiTZiqsQ082.jpg "title=" Leetcode9-1.png "style=" Float:none; "alt=" wkiom1s6qjebzd9daadxitziqsq082.jpg "/>

formal Practice: less optimization. Probably can run to the front 50%, the best record 713ms

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/58/BB/wKioL1S6QWfDrVqbAAEQzImN3uw891.jpg "title=" Leetcode9-2.png "style=" Float:none; "alt=" wkiol1s6qwfdrvqbaaeqzimn3uw891.jpg "/>

Experience? : Is there really a company test so simple?



This article is from the "Code Farmers Self-Cultivation" blog, please be sure to keep this source http://08310302.blog.51cto.com/7006444/1605144

Leetcode notes Two (26, 20,9)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.