qiyuangong / Google_APAC

My solution for Google APAC

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Notice:

  1. Larger dataset only have one chance, and it will expire in 4 minutes. So make sure your code is correct and efficient before submit larger dataset.

  2. Some times Google requires you to mod 1000000007 to avoid long result.

2016 A Round

# Title Solution Basic idea (One line)
B gcube Python

2017 Pactice

# Title Solution Basic idea (One line)
A Lazy Spelling Bee Python \prod_{i=0}^{n - 1} len(set(i - 1, i, i + 1))
B Robot Rock Band Python

2017 A Round

# Title Solution Basic idea (One line)
A Country Leader Python String slicing and sort
B Rain Python
C Jane's Flower Shop Python Binary search on double
D Clash Royale Python

2017 B Round

# Title Solution Basic idea (One line)
A Sherlock and Parentheses Python (n + 1) * n / 2
B Sherlock and Watson Gym Secrets Python Three optimizations:
1. Fast power(x, y) % n
2. 0~k-1 buckets
3. (i + k)^A % k == i^A % k, so if i satisfies, then i + k, i + 2k.... satisfy condition.
C Watson and Intervals Python l and r interval problem, sort and computer count (add on l, subtract on r). When count == 1, it is a unique interval for current interval.
D Sherlock and Permutation Sorting Python f(n) = n! - \sum f(i)*(n- i)!, then optimize dp from O(n^3) to O(n^2)

About

My solution for Google APAC


Languages

Language:Python 92.3%Language:C++ 7.7%