上一页 1 2 3 4 5 6 7 8 9 10 ··· 14 下一页

2013年11月26日

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? 1 public class Solution { 2 public boolean hasCycle(ListNode head) { 3 // IMPORTANT: Please reset any member data you declared, as 4 // the same Solution instance will be ... 阅读全文

posted @ 2013-11-26 09:30 Step-BY-Step 阅读(133) 评论(0) 推荐(0) 编辑

Palindrome Partitioning II

摘要: Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs.For example, givens="aab",Return1since the palindrome partitioning["aa","b"]could be produced using 1 cut.这个两个Dp, 一个是对那 阅读全文

posted @ 2013-11-26 09:23 Step-BY-Step 阅读(199) 评论(0) 推荐(0) 编辑

Palindrome Partitioning

摘要: Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, givens="aab",Return [ ["aa","b"], ["a","a","b"] ]采用DP来做。为了不重复计算palindrome, 使用一个map 存储从[i,j]是否 阅读全文

posted @ 2013-11-26 07:29 Step-BY-Step 阅读(241) 评论(0) 推荐(0) 编辑

Surrounded Regions

摘要: Given a 2D board containing'X'and'O', 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 XX O O XX X O XX O X XAfter running your function, the board should be:X X X XX X X XX X X 阅读全文

posted @ 2013-11-26 07:02 Step-BY-Step 阅读(161) 评论(0) 推荐(0) 编辑

Best Time to Buy and Sell Stock III

摘要: Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete at mosttwotransactions.Note:You may not engage in multiple transactions at the same time (ie, you must sell the stock before you buy again).和前两道题比起来的话, 阅读全文

posted @ 2013-11-26 03:21 Step-BY-Step 阅读(185) 评论(0) 推荐(0) 编辑

2013年11月25日

Max Points on a Line

摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line./** * Definition for a point. * class Point { * i... 阅读全文

posted @ 2013-11-25 05:47 Step-BY-Step 阅读(149) 评论(0) 推荐(0) 编辑

Amazon SED1 面经

该文被密码保护。 阅读全文

posted @ 2013-11-25 03:09 Step-BY-Step 阅读(2) 评论(0) 推荐(0) 编辑

2013年11月23日

亲爱的小孩,今天有没有哭

摘要: 转自:http://blog.sina.com.cn/s/blog_5b1973430102e9jc.html夜里12点下班站在冷风瑟瑟的街边打车,一辆辆车从眼前嗖嗖飞过,一只手用手机回复着各种人的邮件。想到回到家还有好多邮件要发,还有第二天的很多准备工作要做,天天在公司吃加班餐然后坐着不动,只有脑子高速的转,睡觉的时候都停不下来。注意力集中的时候我做事总是很快很快,可惜在大多数时光里我都思维涣散。星盘上说天蝎座三月到四月会进入到全新的领域并且工作满天飞,果不其然,连和家人聊天说话都成了奢侈的事。工作上曾经努力下决心做的打算在某一个瞬间被自己全部推翻,我甚至怀疑我曾经做出的决定是件危险的事,上 阅读全文

posted @ 2013-11-23 09:14 Step-BY-Step 阅读(138) 评论(0) 推荐(0) 编辑

2013年11月19日

(转)天道酬勤,上善若水—八字真言让您立于“不败之地”

摘要: 转自:http://www.cnblogs.com/tianshansoft/p/3430064.html大家好,非常感谢大家能够点击链接进入到本文章,写下这篇文章的目的,一是希望能够给一些新手提供一些职业发展的思路;二是希望得到前辈们的指点;三是希望通过这篇文章来和大家进行交流。文中说的不实或不对的地方请拍砖,一定虚心接受!想结交朋友的,欢迎联系本人!首先自我介绍一下,真名:梁勇,80后,混迹上海五年,从事商业智能方面的技术工作,并且擅长MSSQLSERVER的性能优化,目前在上海某公司就职!同时,自己和几个同事,朋友一起创办了一个小团队,致力推动商业智能技术在国内的普及与发展,让更多的朋友 阅读全文

posted @ 2013-11-19 08:38 Step-BY-Step 阅读(380) 评论(0) 推荐(0) 编辑

(转)人生观、世界观?!

摘要: 作者:Artech出处:http://artech.cnblogs.com/本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。这是一个大得能把牛吓死的话题。上周公司为我们进行企业核心价值(Core Value)的培训,让我们每人写出3条个人价值观。对于这个问题,我之前还真没有人证思考过——到底我的人生信条是什么呢?想了半天,写出了以下三条:一、正直我经常说一句话:“当今中国是一个无法无天的社会”。天,上天,神也。中国没有宗教,中国人不敬鬼神,俨然一个“大无畏”的民族。但是,一旦没有了敬畏,人就会变得没有了底线,这 阅读全文

posted @ 2013-11-19 08:35 Step-BY-Step 阅读(188) 评论(0) 推荐(0) 编辑

评判一个程序员好坏的标准到底是什么?

摘要: 舞台上,一个侃侃而谈、滔滔不绝的人永远有着说不完的话,因为他有核心,有着明确的思路,可以在思绪的海洋乘风破浪,在无垠的天际驰骋。同样地,在IT行业懂得真正原理的人,诸事就显得游刃有余——题记转载下文:在这个IT技术火爆的年代,人人都喜欢学IT,人人都用IT技术,但是评判一个程序员好坏的标准到底是什么呢?翻开各大公司招聘网站,映入眼帘的是各种编程语言要求:大学本科毕业、英语四级、精通JAVA、3年以上JAVA开发经验、熟悉Servlet和MVC、熟练使用MFC、熟练使用Win32 Socket、熟悉Linux网络配置、熟悉Windows shell和Linux Shell,等等诸如此类的招聘条件 阅读全文

posted @ 2013-11-19 08:26 Step-BY-Step 阅读(1749) 评论(0) 推荐(0) 编辑

微软面试100题【机密】

摘要: 1为什么下水道的井盖是圆的?2美国有多少辆车?(一个常见的类似问题是:美国有多少家加油站?)3美国有多少个下水道井盖?4你让某些人为你工作了七天,你要用一根金条作为报酬。这根金条要被分成七块。你必须在每天的活干完后交给他们一块。如果你只能将这根金条切割两次,你怎样给这些工人分?5一列火车以每小时15英里的速度离开洛杉矶,朝纽约进发。另外一列火车以每小时20英里的速度离开纽约,朝洛杉矶进发。如果一只每小时飞行25英里的鸟同时离开洛杉矶,在两列火车之间往返飞行,请问当两列火车相遇时,鸟飞了多远?6假设一张圆盘像唱机上的唱盘那样转动。这张盘一半是黑色,一半是白色。假设你有数量不限的一些颜色传感器。要 阅读全文

posted @ 2013-11-19 08:24 Step-BY-Step 阅读(438) 评论(0) 推荐(0) 编辑

What is the difference between database table and database view?

摘要: The database table has a physical existence in the database. A view is a virtual table, that is one that does not actually exist. View is made up of a query on one or many tables in a database.Indatabase theory, aviewis theresult setof astoredqueryon thedata, which thedatabaseusers can query just as 阅读全文

posted @ 2013-11-19 07:36 Step-BY-Step 阅读(348) 评论(0) 推荐(0) 编辑

How does database indexing work?

摘要: When data is stored on disk based storage devices, it is stored as blocks of data. These blocks are accessed in their entirety, making them the atomic disk access operation. Disk blocks are structured in much the same way as linked lists; both contain a section for data, a pointer to the location of 阅读全文

posted @ 2013-11-19 07:27 Step-BY-Step 阅读(188) 评论(0) 推荐(0) 编辑

Linked List vs Array

摘要: Both Arrays andLinked Listcan be used to store linear data of similar types, but they both have some advantages and disadvantages over each other.Following are the points in favour of Linked Lists.(1) The size of the arrays is fixed: So we must know the upper limit on the number of elements in advan 阅读全文

posted @ 2013-11-19 05:38 Step-BY-Step 阅读(267) 评论(0) 推荐(0) 编辑

Mutex vs Semaphore

摘要: What are the differences between Mutex vs Semaphore? When to use mutex and when to use semaphore?Concrete understanding of Operating System concepts is required to design/develop smart applications. Our objective is to educate the reader on these concepts and learn from other expert geeks.As per ope 阅读全文

posted @ 2013-11-19 05:28 Step-BY-Step 阅读(309) 评论(0) 推荐(0) 编辑

Create a method synchronized without using synchronized keyword

摘要: Actually, lots of ways:No need for synchronization at all if you don't have mutable state.No need for synchronization if the mutable state is confined to a single thread. This can be done by using local variables orjava.lang.ThreadLocal.You can also use built-in synchronizers.java.util.concurren 阅读全文

posted @ 2013-11-19 05:23 Step-BY-Step 阅读(146) 评论(0) 推荐(0) 编辑

mutable关键字

摘要: mutalbe的中文意思是“可变的,易变的”,跟constant(既C++中的const)是反义词。在C++中,mutable也是为了突破const的限制而设置的。被mutable修饰的变量(mutable只能由于修饰类的非静态数据成员),将永远处于可变的状态,即使在一个const函数中。我们知道,假如类的成员函数不会改变对象的状态,那么这个成员函数一般会声明为const。但是,有些时候,我们需要在const的函数里面修改一些跟类状态无关的数据成员,那么这个数据成员就应该被mutalbe来修饰。下面是一个小例子:class ClxTest{ public: void Output() con. 阅读全文

posted @ 2013-11-19 02:15 Step-BY-Step 阅读(202) 评论(0) 推荐(0) 编辑

Surrounded Regions

摘要: Given a 2D board containing'X'and'O', 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 XX O O XX X O XX O X XAfter running your function, the board should be:X X X XX X X XX X X 阅读全文

posted @ 2013-11-19 01:57 Step-BY-Step 阅读(115) 评论(0) 推荐(0) 编辑

2013年11月17日

LeetCode Question Difficulty Distribution

摘要: IDQuestionDiffFreqData StructureAlgorithms1Two Sum25arraysortsetTwo Pointers2Add Two Numbers34linked listTwo PointersMath3Longest Substring Without Repeating Characters32stringTwo Pointershashtable4Median of Two Sorted Arrays53arrayBinary Search5Longest Palindromic Substring42string6ZigZag Conversio 阅读全文

posted @ 2013-11-17 06:32 Step-BY-Step 阅读(519) 评论(0) 推荐(0) 编辑

Pascal's Triangle II

摘要: Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(k) extra space?A Formula for Any Entry in The TriangleIn fact there is a formula fromCombinationsfor working out the value at any place in Pascal& 阅读全文

posted @ 2013-11-17 05:15 Step-BY-Step 阅读(277) 评论(0) 推荐(0) 编辑

2013年11月16日

Populating Next Right Pointers in Each Node II

摘要: Follow up for problem "Populating Next Right Pointers in Each Node".What if the given tree could be any binary tree? Would your previous solution still work?Note:You may only use constant extra space.For example,Given the following binary tree, 1 / \ 2 3 / \ \ 4 5 ... 阅读全文

posted @ 2013-11-16 13:39 Step-BY-Step 阅读(162) 评论(0) 推荐(0) 编辑

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 andsum = 22, 5 / \ 4 8 / / \ 11 13 4 / \ / \ 7 2 5 1return[ [5,4,11,2]... 阅读全文

posted @ 2013-11-16 09:06 Step-BY-Step 阅读(166) 评论(0) 推荐(0) 编辑

Convert Sorted Array to Binary Search Tree

摘要: Given an array where elements are sorted in ascending order, convert it to a height balanced BST.balanced tree 是指 tree的 min depth 和max depth不超过某个数值(1)。而不是完全二叉树!!!! 1 /** 2 * Definition for binary tree 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 ... 阅读全文

posted @ 2013-11-16 07:08 Step-BY-Step 阅读(144) 评论(0) 推荐(0) 编辑

Construct Binary Tree from Inorder and Postorder Traversal

摘要: Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.和pre & in 是一样的。 1 /** 2 * Definition for binary tree 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 * TreeN... 阅读全文

posted @ 2013-11-16 06:43 Step-BY-Step 阅读(137) 评论(0) 推荐(0) 编辑

Construct Binary Tree from Preorder and Inorder Traversal

摘要: Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.本来想先对inorder array做预处理存上val对应的index,结果发现 val可能有duplicates。 1 /**duplicates 2 * Definition for binary tree 3 * public class TreeNode { 4 * int val; 5 * Tr... 阅读全文

posted @ 2013-11-16 06:37 Step-BY-Step 阅读(156) 评论(0) 推荐(0) 编辑

Maximum Depth of Binary Tree

摘要: Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node.一样的。 1 /** 2 * Definition for binary tree 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * TreeNode right; 7 ... 阅读全文

posted @ 2013-11-16 05:54 Step-BY-Step 阅读(130) 评论(0) 推荐(0) 编辑

Binary Tree Zigzag Level Order Traversal

摘要: Given a binary tree, return thezigzag level ordertraversal of its nodes' values. (ie, from left to right, then right to left for the next level and al... 阅读全文

posted @ 2013-11-16 05:48 Step-BY-Step 阅读(199) 评论(0) 推荐(0) 编辑

Binary Tree Level Order Traversal

摘要: Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,20,#,#,15,7}, 3 / \ 9 20 / \ 15 7return its level order traversal as:[ [3], [9,20], [15,7]]confused what"{1,#,2,3}"means?> read more . 阅读全文

posted @ 2013-11-16 05:18 Step-BY-Step 阅读(190) 评论(0) 推荐(0) 编辑

2013年11月15日

Same Tree

摘要: Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value. 1 /** 2 * Definition for binary tree 3 * public class TreeNode { 4 * int val; 5 * TreeNode left; 6 * ... 阅读全文

posted @ 2013-11-15 15:00 Step-BY-Step 阅读(134) 评论(0) 推荐(0) 编辑

Validate Binary Search Tree

摘要: Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only nodes with keysless thanthe node's key.The right subtree of a node contains only nodes with keysgreater thanthe node's key.Both the left and ri 阅读全文

posted @ 2013-11-15 14:10 Step-BY-Step 阅读(136) 评论(0) 推荐(0) 编辑

Binary Tree Inorder Traversal

摘要: Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note... 阅读全文

posted @ 2013-11-15 13:16 Step-BY-Step 阅读(164) 评论(0) 推荐(0) 编辑

2013年11月14日

Restore IP Addresses

摘要: Given a string containing only digits, restore it by returning all possible valid IP address combinations.For example:Given"25525511135",return["255.255.11.135", "255.255.111.35"]. (Order does not matter)Solution:注意这里if(tmp result = null; 3 public ArrayList restoreIpAdd 阅读全文

posted @ 2013-11-14 17:44 Step-BY-Step 阅读(200) 评论(0) 推荐(0) 编辑

Reverse Linked List II

摘要: Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL.No... 阅读全文

posted @ 2013-11-14 17:18 Step-BY-Step 阅读(138) 评论(0) 推荐(0) 编辑

Insertion Sort List

摘要: Sort a linked list using insertion sort. 1 /** 2 * Definition for singly-linked list. 3 * public class ListNode { 4 * int val; 5 * ListNode next; 6 * ListNode(int x) { 7 * val = x; 8 * next = null; 9 * }10 * }11 */12 public class Solution {13 public List... 阅读全文

posted @ 2013-11-14 16:51 Step-BY-Step 阅读(135) 评论(0) 推荐(0) 编辑

Java中finalize()

摘要: 垃圾回收器要回收对象的时候,首先要调用这个类的finalize方法(你可以 写程序验证这个结论),一般的纯Java编写的Class不需要重新覆盖这个方法,因为Object已经实现了一个默认的,除非我们要实现特殊的功能(这 里面涉及到很多东西,比如对象空间树等内容)。不过用Java以外的代码编写的Class(比如JNI,C++的new方法分配的内存),垃圾回收器并不能对这些部分进行正确的回收,这时就需要我们覆盖默认的方法来实现对这部分内存的正确释放和回收(比如C++需要delete)。总之,finalize相当于析构函数,他是垃圾回收器回收一个对象的时候第一个要调用的方法。不过由于Java的垃圾 阅读全文

posted @ 2013-11-14 14:55 Step-BY-Step 阅读(244) 评论(0) 推荐(0) 编辑

Volatile 说明

摘要: Java™ 语言包含两种内在的同步机制:同步块(或方法)和 volatile 变量。这两种机制的提出都是为了实现代码线程的安全性。其中 Volatile 变量的同步性较差(但有时它更简单并且开销更低),而且其使用也更容易出错。Java 语言中的 volatile 变量可以被看作是一种 “程度较轻的synchronized”;与synchronized块相比,volatile 变量所需的编码较少,并且运行时开销也较少,但是它所能实现的功能也仅是synchronized的一部分。本文介绍了几种有效使用 volatile 变量的模式,并强调了几种不适合使用 volatile 变量的情形。锁提供了两种 阅读全文

posted @ 2013-11-14 14:28 Step-BY-Step 阅读(183) 评论(0) 推荐(0) 编辑

学习新技术的10个建议

摘要: 英文原文:10 Tips for Learning a New Technology,编译:@玉面小飞鱼 我们生活在一个振奋人心的时代。我们可以越来越方便廉价地获得大量学习资源。这些资源的传播载体由最初的教室被变成了博客,技术论坛等。坐拥如此众多的学习资源,我们没有任何理由不去好好利用。随之而来的问题便是如何在这知识的海洋中选择自己的前进方向。在这篇文章中,我将简要概括一些技术学习的建议,希望可以给你带来一些启发。尽管我的建议主要涉及的是软件开发方面,但是这些原则在其他领域也同样适用。 1. 克服惯性(Overcoming Inertia) 万事开头难,克服惯性是学习新技术的第一步。... 阅读全文

posted @ 2013-11-14 13:13 Step-BY-Step 阅读(195) 评论(0) 推荐(0) 编辑

一个IT人士的个人经历,给迷失方向的朋友

摘要: 这些日子我一直在写一个实时操作系统内核,已有小成了,等写完我会全部公开,希望能够为国内IT的发展尽自己一份微薄的力量。最近看到很多学生朋友和我当年一样没有方向 ,所以把我的经历写出来与大家共勉,希望能给刚如行的朋友们一点点帮助。 一转眼我在IT行业学习工作已经七年多了,这期间我做过网页,写过MIS、数据库,应用程序,做过通信软件、硬件驱动、协议栈,到现在做操作系统内核和IC相关开发,这中间走了很多弯路,也吃了不少苦。 我上的是一个三流的高校,就连同一个城市的人多数都不知道。因为学校不好也就没有指望能靠学校名气找一个好工作。所有的希望都寄托在自己的努力上了,大一开学前的假期我就开始了学习。记.. 阅读全文

posted @ 2013-11-14 13:07 Step-BY-Step 阅读(188) 评论(0) 推荐(0) 编辑

java中的多线程

摘要: 转自:http://www.cnblogs.com/rollenholt/archive/2011/08/28/2156357.html在java中要想实现多线程,有两种手段,一种是继续Thread类,另外一种是实现Runable接口。对于直接继承Thread的类来说,代码大致框架是:?123456789101112class 类名 extends Thread{方法1;方法2;…public void run(){// other code…}属性1;属性2;…}先看一个简单的例子:?12345678910111213141516171819202122232425262728/*** @a 阅读全文

posted @ 2013-11-14 13:00 Step-BY-Step 阅读(194) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 9 10 ··· 14 下一页

导航