上一页 1 ··· 8 9 10 11 12 13 14 15 下一页

2018年8月9日

721. Accounts Merge

摘要: Given a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements a 阅读全文

posted @ 2018-08-09 18:59 猪猪🐷 阅读(128) 评论(0) 推荐(0)

273 Integer to English Words

摘要: 1,234,567 One (million) 234(thousand) 567() I = 0 Words = “” Words = helper(1,234,567 % 1000) + thousand[I = 1] + “” + words helper(1,234,567 % 1000 = 阅读全文

posted @ 2018-08-09 18:56 猪猪🐷 阅读(130) 评论(0) 推荐(0)

43 Multiply Strings

摘要: use int[] array , instead of use stringbuilder Because we need to accumulate digits on the same index And the result length is no bigger than n + m th 阅读全文

posted @ 2018-08-09 18:55 猪猪🐷 阅读(104) 评论(0) 推荐(0)

What’s a hash map

摘要: What’s a hash map https://www.youtube.com/watch?v=shs0KM3wKv8 How to take care of collision equals hashcode 阅读全文

posted @ 2018-08-09 18:53 猪猪🐷 阅读(92) 评论(0) 推荐(0)

Pass by Value vs. Pass by Reference

摘要: Pass by Value vs. Pass by Reference https://www.youtube.com/watch?v=BHtfb3lfc-g https://www.youtube.com/watch?v=h9uD7ipqu3w https://www.youtube.com/wa 阅读全文

posted @ 2018-08-09 18:50 猪猪🐷 阅读(181) 评论(0) 推荐(0)

string vs stringbuilder

摘要: string vs stringbuilder 阅读全文

posted @ 2018-08-09 18:48 猪猪🐷 阅读(123) 评论(0) 推荐(0)

Intro to IntelliJ

摘要: Intro to IntelliJ https://www.youtube.com/watch?v=c0efB_CKOYo https://www.youtube.com/watch?v=S764o0mAXhg Debugging in IntelliJ https://www.youtube.co 阅读全文

posted @ 2018-08-09 18:47 猪猪🐷 阅读(73) 评论(0) 推荐(0)

Unit Testing

摘要: Unit Testing https://www.youtube.com/watch?v=QDFI19lj4OM https://www.youtube.com/watch?v=iWtxEDE1IR4 阅读全文

posted @ 2018-08-09 18:46 猪猪🐷 阅读(77) 评论(0) 推荐(0)

merge sort

摘要: merge sort https://www.youtube.com/watch?v=iMT7gTPpaqw // time : nlogn // space: n // n : the number of elements in the array public class MergeSort{ public int[] mergeSort(int[] array){ ... 阅读全文

posted @ 2018-08-09 18:44 猪猪🐷 阅读(124) 评论(0) 推荐(0)

494. Target Sum

摘要: 494. Target Sum You are given a list of non-negative integers, a1, a2, ..., an, and a target, S. Now you have 2 symbols + and -. For each integer, you should choose one from + and - as its new symbol... 阅读全文

posted @ 2018-08-09 18:41 猪猪🐷 阅读(152) 评论(0) 推荐(0)

268 Missing Number

摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. Example 1: Example 2: 阅读全文

posted @ 2018-08-09 18:40 猪猪🐷 阅读(139) 评论(0) 推荐(0)

211 Add and Search Word - Data structure design

摘要: Design a data structure that supports the following two operations: search(word) can search a literal word or a regular expression string containing o 阅读全文

posted @ 2018-08-09 18:39 猪猪🐷 阅读(159) 评论(0) 推荐(0)

297. Serialize and Deserialize Binary Tree

摘要: Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or 阅读全文

posted @ 2018-08-09 18:33 猪猪🐷 阅读(118) 评论(0) 推荐(0)

450. Delete Node in a BST

摘要: Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of th 阅读全文

posted @ 2018-08-09 18:31 猪猪🐷 阅读(97) 评论(0) 推荐(0)

Copy tree recursion / iterative

摘要: Copy tree recursion / iterative public TreeNode copy(TreeNode root){ if(root == null) return null; TreeNode newRoot = new TreeNode(root.key); newRoot.left = copy(root.left); newRoot.right ... 阅读全文

posted @ 2018-08-09 18:30 猪猪🐷 阅读(90) 评论(0) 推荐(0)

Construct BST from preorder list

摘要: Given preorder traversal of a binary search tree, construct the BST. For example, if the given traversal is {10, 5, 1, 7, 40, 50}, then the output sho 阅读全文

posted @ 2018-08-09 18:26 猪猪🐷 阅读(131) 评论(0) 推荐(0)

270. Closest Binary Search Tree Value

摘要: Given a non-empty binary search tree and a target value, find the value in the BST that is closest to the target. Note: Given target value is a floati 阅读全文

posted @ 2018-08-09 18:25 猪猪🐷 阅读(100) 评论(0) 推荐(0)

230. Kth Smallest Element in a BST

摘要: Find the kth smallest element in the tree: Log n to reach the smallest element Log n + k (amortized) Given a binary search tree, write a function kthS 阅读全文

posted @ 2018-08-09 18:23 猪猪🐷 阅读(108) 评论(0) 推荐(0)

92. Reverse Linked List II

摘要: Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: 阅读全文

posted @ 2018-08-09 18:22 猪猪🐷 阅读(97) 评论(0) 推荐(0)

25. Reverse Nodes in k-Group

摘要: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to 阅读全文

posted @ 2018-08-09 18:20 猪猪🐷 阅读(99) 评论(0) 推荐(0)

239. Sliding Window Maximum/ min

摘要: 239. Sliding Window Maximum/ min https://www.youtube.com/watch?v=2SXqBsTR6a8 https://www.youtube.com/watch?v=G70qltIBF40 过例子, 写自己的 思路, 然后写自己的代码 class 阅读全文

posted @ 2018-08-09 18:16 猪猪🐷 阅读(156) 评论(0) 推荐(0)

200. Number of Islands

摘要: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen 阅读全文

posted @ 2018-08-09 18:10 猪猪🐷 阅读(121) 评论(0) 推荐(0)

305. Number of Islands II

摘要: A 2d grid map of m rows and n columns is initially filled with water. We may perform an addLand operation which turns the water at position (row, col) 阅读全文

posted @ 2018-08-09 18:09 猪猪🐷 阅读(124) 评论(0) 推荐(0)

uf basics

摘要: uf // quick find: // use int array id[] of length n // p and q are connected if and only if they have the same id // when merge components containing p and q, change all entris who // id equals id... 阅读全文

posted @ 2018-08-09 18:08 猪猪🐷 阅读(116) 评论(0) 推荐(0)

constructor

摘要: There can only be one public class per .java file and class name = file name P62 P63 Constructor: a special method to initialize objects, must have ha 阅读全文

posted @ 2018-08-09 18:06 猪猪🐷 阅读(141) 评论(0) 推荐(0)

Iterator 1

摘要: Iterator 1 Concat iterator 14 Cyclic iterator 22.28 Filter iterator (positive) Predicate 32.10 Sequence iterator Iterator of iterator Iterator inner Iterator outer 55.12 Even ind... 阅读全文

posted @ 2018-08-09 18:05 猪猪🐷 阅读(141) 评论(0) 推荐(0)

Iterator 2

摘要: Iterator 2 Flatten 2d vector 21.13 51.52 Flatten nested list 54.36 1.15 peek iterator Merge list of list , using peek iterator 1.27 Bst 1.49 ======================= // flatten 2d... 阅读全文

posted @ 2018-08-09 18:03 猪猪🐷 阅读(136) 评论(0) 推荐(0)

iterator

摘要: You can call next() without calling hasNext(), You can call hasNext() multiple times without calling next() even once 阅读全文

posted @ 2018-08-09 18:02 猪猪🐷 阅读(85) 评论(0) 推荐(0)

341. Flatten Nested List Iterator

摘要: Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integ 阅读全文

posted @ 2018-08-09 18:00 猪猪🐷 阅读(83) 评论(0) 推荐(0)

284. Peeking Iterator

摘要: Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek() operation -- it e 阅读全文

posted @ 2018-08-09 17:59 猪猪🐷 阅读(95) 评论(0) 推荐(0)

two bst iterator

摘要: bst iterator 阅读全文

posted @ 2018-08-09 17:58 猪猪🐷 阅读(81) 评论(0) 推荐(0)

785 Is Graph Bipartite?

摘要: Given an undirected graph, return true if and only if it is bipartite. Recall that a graph is bipartite if we can split it's set of nodes into two ind 阅读全文

posted @ 2018-08-09 17:52 猪猪🐷 阅读(135) 评论(0) 推荐(0)

323. Number of Connected Components in an Undirected Graph

摘要: Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to find the number of connected 阅读全文

posted @ 2018-08-09 17:52 猪猪🐷 阅读(98) 评论(0) 推荐(0)

261. Graph Valid Tree

摘要: valid tree: no cycle, one connected component Given n nodes labeled from 0 to n-1 and a list of undirected edges (each edge is a pair of nodes), write 阅读全文

posted @ 2018-08-09 17:51 猪猪🐷 阅读(92) 评论(0) 推荐(0)

210. Course Schedule II dfs

摘要: There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to 阅读全文

posted @ 2018-08-09 17:51 猪猪🐷 阅读(147) 评论(0) 推荐(0)

207. Course Schedule dfs

摘要: There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to 阅读全文

posted @ 2018-08-09 17:49 猪猪🐷 阅读(127) 评论(0) 推荐(0)

things to work on

摘要: Cs fundamentals basic data structures like hash map. Time complexity Project deep dive Experience Passion Why the change from math to cs? i still like 阅读全文

posted @ 2018-08-09 17:45 猪猪🐷 阅读(68) 评论(0) 推荐(0)

340. Longest Substring with At Most K Distinct Characters

摘要: Given a string, find the length of the longest substring T that contains at most k distinct characters. Example 1: Input: s = "eceba", k = 2 Output: 3 阅读全文

posted @ 2018-08-09 17:44 猪猪🐷 阅读(120) 评论(0) 推荐(0)

161 One edit distance

摘要: Given two strings s and t, determine if they are both one edit distance apart. Note: There are 3 possiblities to satisify one edit distance apart: Exa 阅读全文

posted @ 2018-08-09 17:42 猪猪🐷 阅读(109) 评论(0) 推荐(0)

764 Largest Plus Sign

摘要: In a 2D grid from (0, 0) to (N-1, N-1), every cell contains a 1, except those cells in the given list mineswhich are 0. What is the largest axis-align 阅读全文

posted @ 2018-08-09 17:41 猪猪🐷 阅读(138) 评论(0) 推荐(0)

上一页 1 ··· 8 9 10 11 12 13 14 15 下一页

导航