自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(131)
  • 收藏
  • 关注

原创 Google 面试题 phone interview

摘自一亩三分地http://www.1point3acres.com/bbs/forum.php?mod=viewthread&tid=200350&extra=page%3D1%26filter%3Dsortid%26sortid%3D311%26searchoption%5B3086%5D%5Bvalue%5D%3D6%26searchoption%5B3086%5D%

2016-08-28 09:16:26 1084

原创 Leetcode 146. 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

2016-02-16 01:21:04 477

原创 DFS + BackTracking

这是Leetcode经典系列题,就是考对于DFS的理解,确实有技术含量想上来Combination上来热一下身,如何回溯。就是加1,减1然后是Combination sum1combination sum2 combination sum3 然后是Permutation permutation2 http://www.shuati

2016-02-14 12:00:28 415

原创 KMP 算法

This is a String matching algorithm, to match the target string to a txt stringThis is wikidephttp://www.geeksforgeeks.org/searching-for-patterns-set-2-kmp-algorithm/

2016-02-14 06:10:52 404

原创 Amazon coding 题解答

没有过了test,之后回来跟新1 LRU/**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

2016-02-14 00:45:17 896

原创 Amazon on compus 面经

coding题circular sorted linked list的插入,backtracking走迷宫,还有内存管理的LUR算法~这三种题型。编程题用C++的话,不支持自己写子函数。递归只能自己写Stack.这里有面经,加油吧,把所有的Case都过了就好了。http://www.1point3acres.com/bbs/thread-16

2016-02-14 00:41:42 4876

原创 GeeksforGeeks 统计一个数组中的相反的数的对数

原帖在这里使用merge sort的方法naive 的方法是O(n2)可以利用merge sort提升到O(nlogn)http://www.geeksforgeeks.org/counting-inversions/This is to counting the inversion of the pairs in a array of integer.就是

2016-02-08 07:33:34 427

原创 GeeksForGeeks Power(x,n)

This is a example to use the divide and conquerWrite a program to calculate pow(x,n)这里用一个int tem 记录Power(x, n/2),然后将两者相乘得到的结果就可以,所以如果计算Power(x,n)jiu

2016-02-08 07:16:55 358

原创 GeeksforGeeks 上关于时间空间复杂度的大O和大zeta分析

传送门:http://www.geeksforgeeks.org/analysis-of-algorithms-set-3asymptotic-notations/我觉得大zita是下界大O是上界

2016-02-07 14:21:08 384

原创 geeksforgeeks

这个是对space complexity 的解释http://www.geeksforgeeks.org/g-fact-86/我在面试的时候得问清楚这个time complexity算不算input的size如果算是怎么做,如果不算是怎么做。

2016-02-07 14:16:13 1270

原创 Geeksforgeeks time complexity

一个time complexity 的问题http://www.geeksforgeeks.org/a-time-complexity-question/

2016-02-07 14:12:23 368

原创 Leetcode 322. Coin Change

You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money

2016-02-07 13:49:48 349

原创 Algorithm, Counting sort

维基百科的链接https://en.wikipedia.org/wiki/Counting_sort这里是这个数组有一个大小的范围,是有限的范围,所以可以是O(n)的效率

2016-02-07 13:02:26 297

原创 基本数据结构-heap实现

//This is to implment the heap structure.public class heap{ int[] array; //This is to record the position now we should add the element to int currPosition = 1; //the length of the heap int

2016-02-07 08:04:19 341

原创 Amazon面经2016/2

楼主拖到了二月份才开始完全的热好身准备找实习是在是略SB,要是早点现在估计Offer 都有了吧Amazon 面经http://www.1point3acres.com/bbs/thread-167097-1-1.html之前1月做的,给大家参考一下:1. 给一个数n,要求打印出长宽为n的直角三角形,比如    3              A

2016-02-07 07:08:10 1539

原创 CC150 LinkedList

CC150中的LinkedList讲的很好,之后上代码,最近太忙了2.1 Write code to remove duplicates from an unsorted linked list. 这道题很简单就是利用HashTable存数然后遇到之前遇到过的节点直接删除如果No buffer used,就是只能使用O(1) space comp

2016-02-04 04:11:44 418

原创 CC150 chapter 8 OOD object-oriented design

OOD is quite difficult, especially for the green programmer like me.When I go to tutorial here http://www.javaworld.com/article/2073352/core-java/simply-singleton.htmlI find there are several

2016-01-31 11:24:13 1021

原创 Leetcode 91. Decode Ways

A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total nu

2016-01-31 09:15:22 468

原创 Leetcode 322. Coin Change

322. Coin Change没有AC,思路就是DP322. Coin Changepublic class Solution { public int coinChange(int[] coins, int amount) { int[] dp = new int[amount + 1]; for(int i = 1; i <= amount

2016-01-31 07:10:30 444

原创 Leetcode bit manipulation 总结

136. Single Number利用Xor 求结果137. Single Number II统计数字出现的数目,如果是1被整除,这一位是0,如果没有被1整除则这一位是0;260. Single Number III利用其中的一位数字区别两个数,然后将两个数构成两个集合,这两个集合分别求XOR,得到的结果就是这两位数。190. Reverse Bits

2016-01-31 06:58:34 526

原创 Leetcode 48. Rotate Image

You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up:

2016-01-31 04:03:37 348

原创 Leetcode 90. Subsets II

iven a collection of integers that might contain duplicates, nums, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain dup

2016-01-31 03:46:44 273

原创 CC150 Bit manipulation

The big manipulation problem on CC150 is quite tricky/there are basically fundamental operation like and or and xor. and we can use the bit movement to solve some problems like set get and

2016-01-31 03:08:46 275

原创 CC150 chapter 1 Arrays and strings.

CC150 chapter 1 总结1HashTable:  实质是Array. 如何实现HashTable 在Java中Here is the way that implments the hash table. A hashtable is a array of listnode. and the time complexity for all the basic operatio

2016-01-31 02:44:50 354

原创 CS 4820 second lecture

stable matching algorithemhttps://en.wikipedia.org/wiki/Stable_marriage_problem

2016-01-30 13:47:50 301

原创 CC150 chapter 8 OOD

Object-oriented design is a very good situation for interviewers to test whether or not the candidates know about coding style well.You can write codes, and it's really difficult to give awesome cod

2016-01-30 13:39:45 574

原创 CC150 16 chapter operating system

There are more fundamental problems in CC150, so it would be good if I can go through the problems in CC150 and go over the basic things on this book. It would definitely help me a lot. The first thin

2016-01-30 13:08:37 436

原创 Leetcode 159 Longest Substring with At Most Two Distinct Characters

This question is quite simple. we do not even use the hash table, cause there just would be two distinct characters in the result string.So we just need to use two integer to record the number for e

2016-01-30 07:24:38 251

原创 Leetcode 249 Group Shifted Strings

The idea is from this postLeetCode: Group Shifted StringsGiven a string, we can “shift” each of its letter to its successive letter, for example: “abc” -> “bcd”. We can keep “shifting” which

2016-01-30 07:21:39 481

原创 Leetcode 314 Binary Tree Vertical Order Traversa

This question is nothing fancy, just need to get the position that the root should be. and the length for the whole arrayThe idea is from here.http://www.shuatiblog.com/blog/2014/12/17/Print-B

2016-01-30 07:13:04 540

转载 Leetcode 274. H-Index

转自http://www.cnblogs.com/yrbbest/p/5031910.html这道题我们没有必要完全排序。这样就多余了。第二种Time complexity is O(n) 的方法比较好,这样我们可以利用Array 来记录Array中每个position 出现的数目http://www.cnblogs.com/yrbbest/p/5031910.

2016-01-30 07:02:28 394

原创 Leetcode 299 Bulls and Cows

You are playing the following Bulls and Cows game with your friend: You write a 4-digit secret number and ask your friend to guess it, each time your friend guesses a number, you give a hint, the hint

2016-01-30 06:45:53 310

原创 Leetcode 215. Kth Largest Element in an Array

public class Solution { public int findKthLargest(int[] nums, int k) { int length = nums.length; } public int helper(int[] nums, int k, int start, int end){ int pivot = nums[e

2016-01-29 23:55:58 296

原创 Leetcode 71. Simplify Path

Given an absolute path for a file (Unix-style), simplify it.For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"So why we need to change the format of the String addres

2016-01-29 23:36:37 234

原创 Leetcode tree的碎碎念

关于Leetcode 中的Tree应该是最简单的一类题。绝大部分题考察队树的遍历,前序,中序,后序对树的遍历。然后还有各种变形体考对树的遍历,还有其他题型考对树的前序遍历 path sum, the maximum depth, and the minimum depth of the tree.  They all need to record return

2016-01-29 11:34:04 188

原创 Leetcode 173. Binary Search Tree Iterator

Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next()

2016-01-29 10:58:48 245

原创 Leetcode 286. Walls and Gates

You are given a m x n 2D grid initialized with these three possible values.-1 - A wall or an obstacle.0 - A gate.INF - Infinity means an empty room. We use the value 231 - 1 = 2147483647 to repres

2016-01-29 05:45:07 297

原创 Leetcode 296 Best Meeting Point

Best Meeting PointTotal Accepted: 701 Total Submissions: 1714 Difficulty: MediumA group of two or more people wants to meet and minimize the total travel distance. You are given a

2016-01-29 05:26:36 605

原创 Leetcode 253 Meeting Rooms II

This is the link to this problemhttp://leetcode0.blogspot.com/2015/12/253-meeting-rooms-ii.htmlThe idea is to for each table, put as many meetings as possible for each table.So in the

2016-01-29 05:17:38 460

原创 Leetcode 252 Meeting Rooms

Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all meetings.For example,Given [[0, 30],[5, 10],[

2016-01-29 05:11:45 619

空空如也

空空如也

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

TA关注的人

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