08 2018 档案
摘要:1. is palindrome solution 1: check to reverse the digit, if they are the same number https://www.geeksforgeeks.org/write-a-c-program-to-reverse-digits
阅读全文
摘要:Solution: recusrion (think about better recursion(memo)) Solution Memo + crack the interview
阅读全文
摘要:Solution: why we use binary search here, thr brute force search method is get max(min (dist)), to reduce time complexixity we need to use binary searc
阅读全文
摘要:Solution: make a queu and coun the number of 0 or use two pointers clerverly(think aboun the logic)
阅读全文
摘要:Basically just clone the graph like clone a list in leetcode 138. there are three ways t solve this (just traverse the graph and put new node into map
阅读全文
摘要:Solution: dfs or bfs or union find FOllow up get max number of islands 695 SOlution dfs + array to store the number There is another aolution with dfs
阅读全文
摘要:Solution: build tree, how to divide the array for each root and subtree we can use map to get the index of the array for a specific element Solution 2
阅读全文
摘要:8/11/2018 had a TOEFL test without preparation. Reading (worry about too much, not familiar with the topic, especially Science, time is tight) Geology
阅读全文
摘要:Solution: O(n) , space: 栈空间O(logn)(from recusrsive expression)加上结果的空间O(n) : O(n) (good reference: https://blog.csdn.net/linhuanmars/article/details/23
阅读全文
摘要:There are three problems in hackrank. two sum http request to get title binary search (find first large/small element)(网上没有一个现成运行的代码) 都是些不是很难的题, 但是因为是
阅读全文
摘要:1. Solution: add popmax this func, you can pop out max at any time , so max stack to track the max elements does not work as minstack(leetcode 155) di
阅读全文
摘要:Solution 1: use an arrayList to implement the min stack, here comes problem: how toget min element, use global min to tag minimal element and then sca
阅读全文
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy
阅读全文
摘要:Reverse a linked list from position m to n. Do it in one-pass and in-place Note: 1 ≤ m ≤ n ≤ length of list. Example: FIrstly, I wanna use stack but n
阅读全文
摘要:Given a singly linked list, determine if it is a palindrome. Example 1: Example 2: Follow up:Could you do it in O(n) time and O(1) space? Sloving with
阅读全文

浙公网安备 33010602011771号