
oj刷题
文章平均质量分 70
dsklfjal123
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
链表环查找(Linked List Cycle II)
问题:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?分析:在链表中查找环,并且判断起始位置,本能原创 2014-09-09 11:52:58 · 773 阅读 · 0 评论 -
【OJ】 Clone Graph无向图赋值问题
OJ's undirected graph serialization:Nodes are labeled uniquely.We use # as a separator for each node, and , as a separator for node label and each neighbor of the node.As an example, consider th原创 2014-10-23 09:41:53 · 780 阅读 · 0 评论 -
Factorial Trailing Zeroes(OJ) 求其阶乘尾数0的个数[1808548329]
问题描述:Given an integer n, return the number of trailing zeroes in n!.Note: Your solution should be in logarithmic time complexity.问题分析:一个2和一个5相乘就会产生一个0,阶乘过程中5的个数肯定会比2多例如: 5! =(2 * 2 * 2原创 2015-01-02 09:05:01 · 1421 阅读 · 0 评论 -
Gas Station 加油站问题【oj】
问题描述:There are N gas stations along a circular route, where the amount of gas at stationi is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station原创 2014-10-20 14:35:50 · 1242 阅读 · 0 评论 -
OJ-Candy 分糖果问题
问题描述:There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requirements:Each child must have at原创 2014-10-20 10:33:26 · 2870 阅读 · 0 评论 -
Copy List with Random Pointer
问题描述:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null.Return a deep copy of the list.解析:含有原创 2014-10-06 11:03:08 · 398 阅读 · 0 评论 -
Word Break
问题:Given a string s and a dictionary of words dict, determine ifs can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = [原创 2014-09-24 11:07:21 · 512 阅读 · 0 评论 -
Single Number n
问题:Given an array of integers, every element appears twice except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without usin原创 2014-09-24 09:52:11 · 444 阅读 · 0 评论 -
Word Break II
问题:Given a string s and a dictionary of words dict, add spaces ins to construct a sentence where each word is a valid dictionary word.Return all such possible sentences.For example, givens原创 2014-09-24 11:19:04 · 695 阅读 · 0 评论 -
插入排序(Insertion Sort List)
问题:解析:由于原创 2014-08-29 12:17:35 · 688 阅读 · 0 评论 -
双向链表实现的简易缓存(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 th原创 2014-08-29 16:24:43 · 1332 阅读 · 0 评论 -
链表排序 Sort List
问题:Sort a linked list in O(n log n) time using constant space complexity.思路:根据原创 2014-08-28 16:11:21 · 612 阅读 · 0 评论 -
计算逆波兰式 (Evaluate Reverse Polish Notation)
这个题目比较容易,很像编译原理原创 2014-08-26 16:26:18 · 804 阅读 · 0 评论 -
反向排列句子中的词(Reverse Words in a String)
今天开始在点击打开链接原创 2014-08-25 22:25:24 · 971 阅读 · 0 评论 -
Maximal Square 求最大全为1的子矩阵(leeCode)
Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area.For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0原创 2015-06-03 16:21:09 · 1372 阅读 · 0 评论