• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
02 2015 档案
VMware coding Challenge:Date of Weekday

摘要:这道题再次证明了这种细节的题目,画个图容易搞清楚 1 import java.util.Scanner; 2 3 4 public class Solution2 { 5 static int DateOfWeekday(int date, int weekday) { 6 ... 阅读全文
posted @ 2015-02-27 14:09 neverlandly 阅读(517) 评论(0) 推荐(0)
VMware Coding Challenge: Possible Scores && Summary: static

摘要:Combination Sum I 那道题的变体 1 /* 2 * Complete the function below. 3 */ 4 5 static int is_score_possible(int score, int[] increments) { 6 A... 阅读全文
posted @ 2015-02-27 12:22 neverlandly 阅读(433) 评论(0) 推荐(0)
Summary: rand5构造rand7

摘要:给一个方法,比如 rand5(), 它能够等概率生成 1-5 之间的整数。 所谓等概率就是1,2,3,4,5 生产的概率均为 0.2 。现在利用rand5(), 构造一个能够等概率生成 1- 7 的方法。这里有两个特别重要的点,一是 如果 rand5() + rand5(), 我们能够产生一个均匀分... 阅读全文
posted @ 2015-02-21 04:37 neverlandly 阅读(527) 评论(0) 推荐(0)
Summary: 书架问题

摘要:Consider the problem of storing n books on shelves in a library. The order of the books is fixedby the cataloging system and so cannot be rearraged. T... 阅读全文
posted @ 2015-02-10 05:29 neverlandly 阅读(892) 评论(0) 推荐(0)
Summary: sorting Algorithms

摘要:Insertion sortis a simplesorting algorithmthat builds the finalsorted array(or list) one item at a time. It is much less efficient on large lists than... 阅读全文
posted @ 2015-02-08 12:01 neverlandly 阅读(370) 评论(0) 推荐(0)
Lintcode: Heapify && Summary: Heap

摘要:Heap的介绍1,介绍2,要注意complete tree和full tree的区别, Heap是complete tree;Heap里面 i 的 children分别是 i*2+1 和 i*2+2,i 的 parent是 (i-1)/2 Heapify的基本思路就是:Given an array 阅读全文
posted @ 2015-02-08 06:57 neverlandly 阅读(2044) 评论(0) 推荐(0)
Lintcode: Implement Queue by Stacks

摘要:As the title described, you should only use two stacks to implement a queue's actions.The queue should support push(element), pop() and top() where po... 阅读全文
posted @ 2015-02-07 07:51 neverlandly 阅读(445) 评论(0) 推荐(1)
Lintcode: Hash Function && Summary: Modular Multiplication, Addition, Power && Summary: 长整形long

摘要:In data structure Hash, hash function is used to convert a string(or any other type) into an integer smaller than hash size and bigger or equal to zer... 阅读全文
posted @ 2015-02-07 07:06 neverlandly 阅读(1768) 评论(1) 推荐(0)
Lintcode: Fizz Buzz

摘要:StringBuffer的用法,append方法的参数可以使boolean, char, char[], CharSequence, double, float, int, long, String, StringBuffer Better way: http://www.cnblogs.com/E 阅读全文
posted @ 2015-02-07 03:22 neverlandly 阅读(732) 评论(0) 推荐(0)
Lintcode: First Bad Version

摘要:The code base version is an integer and start from 1 to n. One day, someone commit a bad version in the code case, so it caused itself and the followi... 阅读全文
posted @ 2015-02-07 03:02 neverlandly 阅读(459) 评论(0) 推荐(0)
Lintcode: Find Peak Element

摘要:There is an integer array which has the following features: * The numbers in adjacent positions are different. * A[0] A[A.length - 1].We define... 阅读全文
posted @ 2015-02-06 13:21 neverlandly 阅读(351) 评论(0) 推荐(0)
Lintcode: Fast Power

摘要:Calculate the a^n % b where a, b and n are all 32bit integers.ExampleFor 2^31 % 3 = 2For 100^1000 % 1000 = 0ChallengeO(logn)这道题跟Pow这道题很像数学问题,要求O(log n... 阅读全文
posted @ 2015-02-06 12:10 neverlandly 阅读(949) 评论(0) 推荐(0)
Lintcode: Delete Digits

摘要:Given string A representative a positive integer which has N digits, remove any k digits of the number, the remaining digits are arranged according to... 阅读全文
posted @ 2015-02-06 06:24 neverlandly 阅读(2578) 评论(0) 推荐(1)
Lintcode: Digit Counts

摘要:Count the number of k's between 0 and n. k can be 0 - 9.Exampleif n=12, in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], we have FIVE 1's (1, 10, 11, 12... 阅读全文
posted @ 2015-02-05 12:25 neverlandly 阅读(3335) 评论(0) 推荐(0)
Lintcode: Compare Strings

摘要:Compare two strings A and B, determine whether A contains all of the characters in B.The characters in string A and B are all Upper Case letters.Examp... 阅读全文
posted @ 2015-02-05 06:04 neverlandly 阅读(1386) 评论(0) 推荐(1)
Lintcode: First Position of Target (Binary Search)

摘要:Binary search is a famous question in algorithm.For a given sorted array (ascending order) and a target number, find the first index of this number in... 阅读全文
posted @ 2015-02-05 05:26 neverlandly 阅读(777) 评论(0) 推荐(0)
Lintcode: Binary Representation

摘要:Given a (decimal - e g 3.72) number that is passed in as a string,return the binary representation that is passed in as a string.If the number can no... 阅读全文
posted @ 2015-02-05 04:56 neverlandly 阅读(2028) 评论(0) 推荐(0)
Lintcode: Backpack II

摘要:Given n items with size A[i] and value V[i], and a backpack with size m. What's the maximum value can you put into the backpack?NoteYou cannot divide ... 阅读全文
posted @ 2015-02-04 14:36 neverlandly 阅读(2147) 评论(0) 推荐(1)
Lintcode: Backpack

摘要:Given n items with size A[i], an integer m denotes the size of a backpack. How full you can fill this backpack? NoteYou can not divide any item into s... 阅读全文
posted @ 2015-02-03 09:14 neverlandly 阅读(3805) 评论(2) 推荐(0)
Lintcode: A+B problem

摘要:For given numbers a and b in function aplusb, return the sum of them.NoteYou don't need to parse the input and output. Just calculate and return.Examp... 阅读全文
posted @ 2015-02-03 06:36 neverlandly 阅读(3934) 评论(0) 推荐(0)
Summary: Lowest Common Ancestor in a Binary Tree & Shortest Path In a Binary Tree

摘要:转自:Pavel's BlogNow let's say we want to find the LCA for nodes 4 and 9, we will need to traverse the whole tree to compare each node so that we can lo... 阅读全文
posted @ 2015-02-01 13:25 neverlandly 阅读(537) 评论(0) 推荐(0)
Summary: Prime

摘要:最近遇到很多问题都跟Prime有关,于是总结一下:Prime definition:Aprime number(or aprime) is anatural numbergreater than 1 that has no positivedivisorsother than 1 and itsel... 阅读全文
posted @ 2015-02-01 06:12 neverlandly 阅读(493) 评论(0) 推荐(0)

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3