摘要:
Problem Link If we pick A[i] the 2nd time, it means we have a cycle. Proof: 1st time we pick A[i], the sum before adding A[i] is x; 2nd time we pick A 阅读全文
摘要:
Problem Link Based on initial observation, it seems that greedily pick the smallest row / column length works. But the last example test case outputs 阅读全文
摘要:
1. The 1st palindromic number is 0, so we do N-- to exclude 0. 2. F(k): the number of palindromic numbers of length k. F(1) = 9; F(2) = 9; F(k) = F(k 阅读全文
摘要:
You are given an array nums which is a permutation of [0, 1, 2, ..., n - 1]. The score of any permutation of [0, 1, 2, ..., n - 1] named perm is defin 阅读全文
摘要:
Key idea: For a given box and a list of balls that can be placed in this box, we should choose the ball with the smallest R. Proof: say we have box B 阅读全文
摘要:
Incorrect solution: greedily find out how many consecutive S we can convert to all o. Then for the remaining replace operations, try each starting pos 阅读全文
摘要:
Problem Statment Assume the first N - 1 rounds have been played and we are left with a %7 value R. There are 2 cases depending on who plays the last r 阅读全文
摘要:
Problem Statement If we add edges between every pair of sets that have shared elements, there will be O(N^2) edges to traverse. Instead, we can add N 阅读全文
摘要:
The key observation is that there is always at most 1 cell that violates both conditions. Proof: if x violates both conditions, that means all other n 阅读全文
摘要:
You are given an undirected graph (the "original graph") with n nodes labeled from 0 to n - 1. You decide to subdivide each edge in the graph into a c 阅读全文