Elmagnifico's Blog

云深不知归处

LeetCode Solution(Easy.61-64)

c/c++,python,for work

61.Count Primes Description: Count the number of prime numbers less than a non-negative number, n. Credits: Special thanks to @mithmatt for adding this problem and creating all test cases. Hin...

LeetCode Solution(Easy.57-60)

c/c++,python,for work

57.Implement strStr() Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 57.Implement strStr()-Analysis 判断一个字符串是否是另外一个...

LeetCode Solution(Easy.53-56)

c/c++,python,for work

53.Add Binary Given two binary strings, return their sum (also a binary string). For example a = "11" b = "1" Return “100”. 53.Add Binary-Analysis 给二进制的string 然后求和 还能更简单吗? 方法一把string的二进制直接转...

LeetCode Solution(Easy.49-52)

c/c++,python,for work

49.Count and Say The count-and-say sequence is the sequence of integers beginning as follows: 1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11. 11 is read off as "two 1s" or 21. 21 is...

LeetCode Solution(Easy.45-48)

c/c++,python,for work

45.Remove Nth Node From End of List Given a linked list, remove the nth node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, and n = 2. Afte...

LeetCode Solution(Easy.41-44)

c/c++,python,for work

41.Valid Sudoku Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules. The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’. A par...

LeetCode Solution(Easy.37-40)

c/c++,python,for work

37.Minimum Depth of Binary Tree Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. 37...

LeetCode Solution(Easy.33-36)

c/c++,python,for work

33.Binary Tree Level Order Traversal Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level). For example: Given binary tree {3,9,20,#...

LeetCode Solution(Easy.29-32)

c/c++,python,for work

29.Plus One Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list. 29.Plus ...

LeetCode Solution(Easy.25-28)

c/c++,python,for work

25.Remove Element Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It doesn’t matter what you leave beyond ...