2018年7月18日

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-07-18 13:16 猪猪🐷 阅读(85) 评论(0) 推荐(0)

20. Valid Parentheses

摘要: Three pairs {} [] () If we see {, we push } into the stack If we see [, we push ] into the stack If we see (, we push ) into the stack If we see curre 阅读全文

posted @ 2018-07-18 13:10 猪猪🐷 阅读(103) 评论(0) 推荐(0)

71. Simplify Path

摘要: “..” Means go up a level, so delete the prev “.” Means do nothing “” Means do nothing First, we need to split the input by the splitter “/” 这种方式Arrays 阅读全文

posted @ 2018-07-18 13:07 猪猪🐷 阅读(118) 评论(0) 推荐(0)

311. Sparse Matrix Multiplication

摘要: class Solution { public int[][] multiply(int[][] A, int[][] B) { int m = A.length; int n = A[0].length; int nB = B[0].length; int[][] C = new int[m][nB]; for(... 阅读全文

posted @ 2018-07-18 12:54 猪猪🐷 阅读(99) 评论(0) 推荐(0)

554. Brick Wall

摘要: There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. Yo 阅读全文

posted @ 2018-07-18 12:52 猪猪🐷 阅读(87) 评论(0) 推荐(0)

252. Meeting Rooms

摘要: /** * Definition for an interval. * public class Interval { * int start; * int end; * Interval() { start = 0; end = 0; } * Interval(int s, int e) { st 阅读全文

posted @ 2018-07-18 12:45 猪猪🐷 阅读(131) 评论(0) 推荐(0)

345. Reverse Vowels of a String

摘要: Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Example 2: Input: "leetcode" Output: "leotcede" Exam 阅读全文

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

344. Reverse String

摘要: Write a function that takes a string as input and returns the string reversed. Example 1: Input: "hello" Output: "olleh" Example 2: Input: "A man, a p 阅读全文

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

415. Add Strings

摘要: This one is very similar to add binary , pretty much the same The only difference is % 10, /10 When the two strings are exhausted, need to check if th 阅读全文

posted @ 2018-07-18 09:45 猪猪🐷 阅读(109) 评论(0) 推荐(0)

67. Add Binary

摘要: this one is two strings added together. Still need to add the Two element from two string from the last digit Use a string builder to add backwards, b 阅读全文

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

66. Plus One

摘要: Plus one : so There are a case when the last one is 9, then 1 plus 9 is 0, continue to check if the previous element is 9 or other numbers , if the pr 阅读全文

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

138. Copy List with Random Pointer

摘要: 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-07-18 09:37 猪猪🐷 阅读(101) 评论(0) 推荐(0)

328. Odd Even Linked List

摘要: Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the 阅读全文

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

141. Linked List Cycle

摘要: Given a linked list, determine if it has a cycle in it. Follow up:Can you solve it without using extra space? Given a linked list, determine if it has 阅读全文

posted @ 2018-07-18 09:28 猪猪🐷 阅读(61) 评论(0) 推荐(0)

369. Plus One Linked List

摘要: Given a non-negative integer represented as non-empty a singly linked list of digits, plus one to the integer. You may assume the integer do not conta 阅读全文

posted @ 2018-07-18 09:27 猪猪🐷 阅读(94) 评论(0) 推荐(0)

445. Add Two Numbers II

摘要: You are given two non-empty linked lists representing two non-negative integers. The most significant digit comes first and each of their nodes contai 阅读全文

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

2. Add Two Numbers

摘要: You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contai 阅读全文

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

160. Intersection of Two Linked Lists

摘要: Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文

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

21. Merge Two Sorted Lists

摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example: 阅读全文

posted @ 2018-07-18 09:21 猪猪🐷 阅读(75) 评论(0) 推荐(0)

86. Partition List

摘要: Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the 阅读全文

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

导航