Skip to content

Instantly share code, notes, and snippets.

View idiotleon's full-sized avatar
💭
Unstoppable

Yang Lyu (Leon) idiotleon

💭
Unstoppable
View GitHub Profile
@idiotleon
idiotleon / leetcode_retag.md
Created April 27, 2020 23:19 — forked from Windsooon/leetcode_retag.md
Retag most popular Leetcode problems
@idiotleon
idiotleon / leetcode_retag.md
Created April 27, 2020 23:19 — forked from Windsooon/leetcode_retag.md
Retag most popular Leetcode problems
@idiotleon
idiotleon / cp_syllabus.md
Created May 10, 2020 05:49 — forked from sharmaeklavya2/cp_syllabus.md
Competitive Programming Syllabus

Competitive Programming Syllabus

Geometry

  • Problems - Refer the article for a list of problems which can be solved using Rotating Calipers technique.
class Solution{
public cutPiles(int[] piles, int target){
int max = 0;
for(int pile : piles){
max = Math.max(max, pile);
}
int lo = 1, hi = max;
while(lo < hi){
/**
* Time Complexity: O(N)
* O(N), total number of N-arry tree nodes
*
* Space Complexity: O(W) + O(N)
* O(W), the maximum width of this N-arry tree
* O(N), consumed by the answer N-arry tree
*
*
* Example 1: [1, null, 3, 2, 4, null, 5, 6]
public class SolutionAlmostEquivalentStrings{
public String[] almostEquivalent(String[] s, String[] t){
// sanity check
if(s == null || t == null || s.length != t.length) return new String[0];
final int N = s.length;
String[] ans = new String[N];
traversal: for(int i = 0; i < N; ++i){
int[] freq = new int[26];