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 阅读全文
posted @ 2018-08-26 09:12 wz30 阅读(357) 评论(0) 推荐(0)
摘要:Solution: recusrion (think about better recursion(memo)) Solution Memo + crack the interview 阅读全文
posted @ 2018-08-22 10:58 wz30 阅读(162) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-08-19 11:14 wz30 阅读(452) 评论(0) 推荐(0)
摘要:Solution: make a queu and coun the number of 0 or use two pointers clerverly(think aboun the logic) 阅读全文
posted @ 2018-08-17 12:55 wz30 阅读(162) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-08-17 12:40 wz30 阅读(496) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-08-14 08:58 wz30 阅读(243) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-08-13 05:43 wz30 阅读(209) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-08-12 10:00 wz30 阅读(156) 评论(0) 推荐(0)
摘要:Solution: O(n) , space: 栈空间O(logn)(from recusrsive expression)加上结果的空间O(n) : O(n) (good reference: https://blog.csdn.net/linhuanmars/article/details/23 阅读全文
posted @ 2018-08-10 15:11 wz30 阅读(177) 评论(0) 推荐(0)
摘要:There are three problems in hackrank. two sum http request to get title binary search (find first large/small element)(网上没有一个现成运行的代码) 都是些不是很难的题, 但是因为是 阅读全文
posted @ 2018-08-09 15:56 wz30 阅读(300) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-08-09 13:28 wz30 阅读(406) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-08-08 03:22 wz30 阅读(114) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-08-07 06:09 wz30 阅读(183) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-08-06 06:51 wz30 阅读(209) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-08-05 10:48 wz30 阅读(215) 评论(0) 推荐(0)