随笔分类 -  算法题

上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页
摘要:Description:Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element fro... 阅读全文
posted @ 2015-07-30 09:35 Pickle 阅读(215) 评论(0) 推荐(0)
摘要:Description:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked list is 1 ... 阅读全文
posted @ 2015-07-29 21:18 Pickle 阅读(185) 评论(0) 推荐(0)
摘要:Description:Write a SQL query to find all numbers that appear at least three times consecutively.+----+-----+| Id | Num |+----+-----+| 1 | 1 || 2 ... 阅读全文
posted @ 2015-07-10 00:20 Pickle 阅读(269) 评论(0) 推荐(0)
摘要:Description:Given an integer, write a function to determine if it is a power of two.public class Solution { public boolean isPowerOfTwo(int n) { ... 阅读全文
posted @ 2015-07-06 11:45 Pickle 阅读(210) 评论(0) 推荐(0)
摘要:Description:Implement a basic calculator to evaluate a simple expression string.The expression string contains only non-negative integers, +, -, *, / ... 阅读全文
posted @ 2015-07-01 23:32 Pickle 阅读(195) 评论(0) 推荐(0)
摘要:Description:Implement a basic calculator to evaluate a simple expression string.The expression string may contain open ( and closing parentheses ), th... 阅读全文
posted @ 2015-07-01 23:28 Pickle 阅读(184) 评论(0) 推荐(0)
摘要:Description:Implement int sqrt(int x).Compute and return the square root of x.好好学习数学还是非常有用的,牛顿迭代法 求解。 计算x2= n的解,令f(x)=x2-n,相当于求解f(x)=0的解,如左图所示。 首先取x0,... 阅读全文
posted @ 2015-06-29 00:10 Pickle 阅读(184) 评论(0) 推荐(0)
摘要:Description:Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will r... 阅读全文
posted @ 2015-06-28 23:54 Pickle 阅读(212) 评论(0) 推荐(0)
摘要:Description:Given a sorted array of integers, find the starting and ending position of a given target value.Your algorithm's runtime complexity must b... 阅读全文
posted @ 2015-06-28 00:47 Pickle 阅读(203) 评论(0) 推荐(0)
摘要:超时了,只能先这么干了。return Math.pow(x, n); 阅读全文
posted @ 2015-06-28 00:16 Pickle 阅读(142) 评论(0) 推荐(0)
摘要:Description: Given an array of integers, every element appears three times except for one. Find that single one.只有一个出现一次的数字,其他的都出现了3次,找出出现一次的那个数字。pub... 阅读全文
posted @ 2015-06-27 23:36 Pickle 阅读(149) 评论(0) 推荐(0)
摘要:Description:Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5",... 阅读全文
posted @ 2015-06-27 00:08 Pickle 阅读(220) 评论(0) 推荐(0)
摘要:Description: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 large... 阅读全文
posted @ 2015-06-26 00:42 Pickle 阅读(201) 评论(0) 推荐(0)
摘要:Description:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct eleme... 阅读全文
posted @ 2015-06-25 22:45 Pickle 阅读(198) 评论(0) 推荐(0)
摘要:Description:Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the... 阅读全文
posted @ 2015-06-25 00:18 Pickle 阅读(230) 评论(0) 推荐(0)
摘要:Description:Given an array of integers, every element appears twice except for one. Find that single one.找出只出现一次的数。public class Solution { public i... 阅读全文
posted @ 2015-06-24 23:06 Pickle 阅读(184) 评论(0) 推荐(0)
摘要:Description:https://leetcode.com/problems/rectangle-area/public class Solution { public int computeArea(int A, int B, int C, int D, int E, int F, i... 阅读全文
posted @ 2015-06-24 00:50 Pickle 阅读(225) 评论(0) 推荐(0)
摘要:Description:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any posi... 阅读全文
posted @ 2015-06-24 00:33 Pickle 阅读(190) 评论(0) 推荐(0)
摘要:Description:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint... 阅读全文
posted @ 2015-06-23 23:57 Pickle 阅读(197) 评论(0) 推荐(0)
摘要:Description: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... 阅读全文
posted @ 2015-06-19 23:11 Pickle 阅读(187) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 13 14 15 16 下一页