The Travels of Marco Cai

  • Home

  • About

  • Tags

  • Archives

  • Search

[LeetCode] Challenge log 657

Posted on 2018-04-09 |
657. Judge Route Circle

Simple, no need to comment

Read more »

[LeetCode] Challenge log 797

Posted on 2018-04-09 |
797. All Paths From Source to Target
  1. Basic DFS problem.
  2. Caching may accerlerate the time, but I did not try~
Read more »

[LeetCode] Challenge log 461

Posted on 2018-04-09 | Edited on 2018-04-10 | 0 Comments
461. Hamming Distance

https://leetcode.com/problems/hamming-distance/description/

  1. Use bitwise operation XOR (1 if the bit is different).
  2. Count the number of 1 bits ( exactly as NO.191).
Read more »

[LeetCode] Challenge log 535

Posted on 2018-04-07 |
535. Encode and Decode TinyURL

https://leetcode.com/problems/encode-and-decode-tinyurl/description/

  1. Solution1: Use increasing numbers to mark tiny urls; actual urls are saved in a indexed list. (If want letters, can transfer the number into 62-based)
  2. Alternative: Genrate random 6-places string as tiny url. Two dictionaries to allow mapping in two ways and no duplicate.
Read more »

[LeetCode] Challenge log 804

Posted on 2018-04-07 |
804. Unique Morse Code Words

https://leetcode.com/problems/unique-morse-code-words/description/

  1. Use set to maintain unique words.
  2. String is hashable.
Read more »

[LeetCode] Challenge log 771

Posted on 2018-04-06 | Edited on 2018-04-07 |
771. Jewels and Stones

https://leetcode.com/problems/jewels-and-stones/description/

  1. Use hashing to achieve O(n+m).
  2. Use set as a dict without value to save space
Read more »

[LeetCode] Challenge log 215

Posted on 2018-04-06 | Edited on 2018-04-07 |
215. Kth Largest Element in an Array

https://leetcode.com/problems/kth-largest-element-in-an-array/description/

  1. Use len(k)-array to save the largest k elements
  2. Through binary search insertion to keep the array sorted.
Read more »

[Gundam] Metal Build F91

Posted on 2018-04-06 | Edited on 2018-05-10 | 0 Comments

MB F91 ps

Read more »

[LeetCode] Challenge log 152

Posted on 2018-04-05 | Edited on 2018-04-10 |
152. Maximum Product Subarray

https://leetcode.com/problems/maximum-product-subarray/description/

It is a DP problem. Similar to 53.

Read more »

[LeetCode] Challenge log 53

Posted on 2018-04-05 | 0 Comments
53. Maximium Subarray

https://leetcode.com/problems/maximum-subarray/description/

It is mainly a DP problem.

Read more »
1…91011…13
Mingxiang Cai

Mingxiang Cai

A learner, a hobbyist.

128 posts
56 tags
© 2019 Mingxiang Cai
0%