#note#Cracking the coding interview Big O analysis of recursion: Try to remember this pattern. When you have a recursive function that makes multiple calls, the runtime will often (but not always) look like O(branche's depth), wher...
#work note# consistant hashing 需要做一个 account bucket,1% ~ 10% 与 10% ~ 20% 是不同的,实现方法就是 对 account_id hash,然后 mod 100, 取余数,即此 account_id 对应的 account_bucket 最开始我的实现是,sha256(account_id) --> 转换成 string --> 获取string的hashCode(...
#leetcode# Plus One Given a non-empty array of digits representing a non-negative integer, plus one to the integer.The digits are stored such that the most significant digit is at the head of the list, and each element...
Python学习笔记 工作需要熟悉一下Python, 在看Learn Python the hard way, 记点笔记-------------------------------------------------------------------------------------------------------- What is the difference between %r and %s?
#leetcoce#277. Find the Celebrity Suppose you are at a party withnpeople (labeled from0ton - 1) and among them, there may exist one celebrity. The definition of a celebrity is that all the othern - 1people know him/her but
#leetcode#647. Palindromic Substrings https://leetcode.com/problems/palindromic-substrings/description/Given a string, your task is to count how many palindromic substrings in this string.The substrings with different start indexes
#leetcode#130. Surrounded Regions iven a 2D board containing'X'and'O'(theletterO), capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region.For example,X X X
#leetcode#38. Count and Say The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as "one 1" or 11.11 is read o
#leetcode#547. Friend Circles There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and B is a direct friend of C, the
#leetcode#500 Keyboard Row Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.Example 1:Input: ["Hello", "Alaska", "Da
#leetcode#Ugly Numbers 2 Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first
#leetcode#305. Number of Islands II A 2d grid map of m rows andn columns is initially filled with water. We may perform anaddLand operation which turns the water at position (row, col) into a land. Given a list of positions to opera
#leetcode#220. Contains Duplicate III Given an array of integers, find out whether there are two distinct indices i and j in the array such that the absolute difference between nums[i] and nums[j] is at most t and the absolute diffe
#leetcode#179. Largest Number Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result may be ve
#leetcode#329. Longest Increasing Path in a Matrix Given an integer matrix, find the length of the longest increasing path.From each cell, you can either move to four directions: left, right, up or down. You may NOT move diagonally or move outside
#leetcode#202. Happy Number https://leetcode.com/problems/happy-number/Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive inte
#leetcode#515. Find Largest Element in Each Row 515. Find Largest Element in Each RowMy SubmissionsBack To ContestUser Accepted: 851 User Tried: 878 Total Accepted: 943 Total Submissions: 2140 Difficulty: MediumY
#leetcode#513. Find Left Most Element My SubmissionsBack To Contest 513. Find Left Most ElementMy SubmissionsBack To ContestUser Accepted: 870 User Tried: 943 Total Accepted: 882 Total Submissions: 2399Difficulty: MediumGiven a bina
#leetcode# Base 7 504. Base 7My SubmissionsBack To ContestGiven an integer, return its base 7 string representation.Example 1:Input: 100Output: "202"Example 2:Input: -7Outpu