自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(121)
  • 资源 (1)
  • 收藏
  • 关注

原创 #leetcode 56 Merge Intervals

【代码】#leetcode 56 Merge Intervals。

2023-10-05 02:58:42 271

原创 #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...

2019-01-09 07:55:59 168

原创 #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(...

2019-01-09 07:53:16 200

原创 #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...

2018-12-26 15:20:21 179

原创 Python学习笔记

工作需要熟悉一下Python, 在看Learn Python the hard way, 记点笔记-------------------------------------------------------------------------------------------------------- What is the difference between %r and %s?

2017-12-11 16:18:48 329

原创 #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

2017-09-18 08:45:06 529 1

原创 #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

2017-09-18 02:08:00 855

原创 #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

2017-08-21 09:12:05 354 1

原创 #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

2017-06-14 16:07:12 459

原创 #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

2017-06-14 15:29:28 521

原创 #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

2017-06-11 11:13:55 316

原创 #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

2017-06-10 15:12:52 324

原创 #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

2017-06-02 16:27:20 640

原创 #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

2017-05-26 14:37:11 390

原创 #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

2017-05-23 13:38:01 320

原创 #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

2017-05-08 09:11:36 501

原创 #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

2017-02-20 15:31:22 298

原创 #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

2017-02-13 14:33:47 515

原创 #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

2017-02-13 14:14:43 375

原创 #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

2017-02-13 13:36:31 654

转载 #Google面经#

原链接:  http://www.mitbbs.com/article_t/JobHunting/33218429.htmlGoogle电面:LC 340Onsite:很诡异的onsite1. 印度。给一个xxx{xxx}xxx{xx}字符串,括号里面每次只能选一个字符,要求给出所有可能组合。貌似不难,但是代码量很大,写的很屎。2. 老中。先一个detect

2016-09-03 08:10:14 670

原创 #leetcode#Sum of Two Integers

Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.Example:Given a = 1 and b = 2, return 3.=================================不让用加减符号,很自然想

2016-08-18 14:38:12 375

原创 #leetcode#Nim Game

You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the

2016-08-10 14:57:12 312

原创 #leetcode#Reverse String

好久没刷题,准备刷起来了,leetcode都300多题了, 世界变化太快随便找了个简单题,Reverse String,很自然就想到用StringBuilder从尾到头撸一遍,代码如下public class Solution { public String reverseString(String s) { if(s == null || s.length

2016-08-08 15:16:49 403

原创 #Hive#Hive Warning: Value had a \n character in it

工作中用到Hive,把一些trouble shooting的东西记录下来Log 如下 ===============================================Hive Warning: Value had a \n character in it--》 遇到这个错误一般是hive query的格式问题, 哪里缺了个分号  “;”

2016-01-30 02:51:19 4150 1

原创 #leetcode#First Bad Version

You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on the

2015-09-15 13:36:19 574

原创 #leetcode#Rotate List

Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->NULL.分析:注意k有可能会大于list的长度,所以先求出list

2015-07-31 01:41:53 588

原创 #EPI#Find running median from a stream of integers

连续stream取median,如果数据量不大,维护两个heap,一个max heap存小半部分,一个min heap存大的半部分,只看两个heap的root值就可以得到median,For the first two elements add smaller one to the maxHeap on the left, and bigger one to the minHeap o

2015-07-29 11:01:10 946

原创 #leetcode#Sum Root to Leaf Numbers

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 which represents the number 123.Find the tota

2015-07-26 14:35:48 697

原创 #leetcode#Simplify Path

Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to show corner cases.Corner Cases:Did

2015-07-25 03:42:37 777

原创 #leetcode#Path Sum II

Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree and sum = 22, 5 / \

2015-07-23 12:41:57 863

原创 #leetcode#Search a 2D Matrix II

Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sorted in ascending from left to right.Integers in

2015-07-23 05:43:50 988

原创 #leetcode#Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car" is not a

2015-07-22 16:53:39 649

原创 #leetcode#Symmetric Tree

Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2 / \ / \3 4 4 3But the f

2015-07-22 15:10:11 540

原创 #leetcode#LRU Cache

Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.get(key) - Get the value (will always be positive) of the key if

2015-07-22 08:51:02 792

原创 #leetcode#Anagrames

Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.分析:判断两个String是不是anagrams,比较简单的方法就是先转换成charArray,然后排序,然后重新生成String,看是否相同, 这个Stri

2015-07-21 06:14:16 616

原创 #leetcode#Intersection of Two LinkedList

Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists: A: a1 → a2 ↘

2015-07-20 16:38:35 664

原创 #leetcode#One Edit Distance

Given two strings S and T, determine if they are both one edit distance apart.分析:one edit distance,要么S,T长度相同, 只有一对不同char,那么只要跳过这对不同的char,应该能匹配完两个String的;

2015-07-20 16:18:05 966

原创 #leetcode#Find Peak Element

Find Peak ElementTotal Accepted:31990Total Submissions:101250My SubmissionsQuestionSolutionA peak element is an element that is greater than its neighbors.Given an input

2015-07-18 16:36:24 481 1

原创 #leetcode#Missing Ranges

Missing Ranges Total Accepted: 2544 Total Submissions: 10515My SubmissionsQuestion Solution Given a sorted integer array where the range of elements are [lower, upper] inclusive,

2015-07-16 14:12:35 818

Amazon AWS Overview

Overview of Amazon Web Services, 大体介绍了亚马逊的云计算框架

2015-06-05

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除