OJ题
文章平均质量分 92
sduzh9011
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【LeetCode】Reverse Words in a String
题目地址:https://oj.leetcode.com/problems/reverse-words-in-a-string/ 描述: 给定一个字符串S, 以单词为单位逆序输出,如输入:"the sky is blue",则输出“blue is sky the". 单词的定义:连续的非空白字符序列。 输入字符可以以空白字符开头和结尾原创 2014-07-25 23:52:47 · 637 阅读 · 0 评论 -
POJ练习——1001 Exponentiation
题目: Description Problems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing experience for ma原创 2013-10-13 00:30:34 · 669 阅读 · 0 评论 -
【LeetCode】Insertion Sort List
Sort a linked list using insertion sort.原创 2014-08-11 00:19:02 · 490 阅读 · 0 评论 -
【LeetCode】LRU Cache
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)原创 2014-08-13 23:24:56 · 477 阅读 · 0 评论 -
【LeetCode】Reorder List
Given a singly linked list L: L0→L1→…→Ln-1→Ln, reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For example, Given {1,2,3,4}, reorder it to {1,4原创 2014-08-27 23:34:02 · 400 阅读 · 0 评论 -
【LeetCode】Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Follow up: Can you solve it without using extra space? 思路: 首先利用快慢在原创 2014-08-28 00:00:25 · 509 阅读 · 0 评论 -
【UVaOJ】133 - The Dole Queue
The Dole Queue In a serious attempt to downsize (reduce) the dole queue, The NewNational Green Labour Rhinoceros Party has decided on the followingstrategy. Every day all dole applicants原创 2014-08-16 00:07:38 · 628 阅读 · 0 评论 -
【UVaOJ】127 - "Accordian" Patience
``Accordian'' Patience You are to simulate the playing of games of ``Accordian'' patience, the rules for which are as follows: Deal cards one by one in a row from left to right, not ove原创 2014-08-15 16:06:10 · 534 阅读 · 0 评论 -
【UVaOJ】101 - The Blocks Problem
The Blocks Problem Background Many areas of Computer Science use simple, abstract domains for both analytical and empirical studies. For example, an early AIstudy of planning and rob原创 2014-08-15 17:34:44 · 513 阅读 · 0 评论 -
【LeetCode】Best Time to Buy and Sell Stock III
https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/ 这题原创 2014-09-23 18:57:27 · 538 阅读 · 0 评论 -
【LeetCode】Binary Tree Level Order Traversal II
题目: Binary Tree Level Order Traversal II Total Accepted: 18664 Total Submissions: 59503 Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from le原创 2014-09-23 21:26:19 · 541 阅读 · 0 评论 -
【LeetCode】Word Break
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given s = "leetcode", dict = ["leet",原创 2014-09-23 18:41:50 · 525 阅读 · 0 评论 -
【LeetCode】Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock),原创 2014-09-23 18:48:54 · 528 阅读 · 0 评论 -
【UVaOJ】401 Palindromes
Palindromes A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string "ABCDEDCBA" is a palindrome because it is the same when the string原创 2013-12-25 13:32:20 · 651 阅读 · 0 评论 -
【LeetCode】Linked List Cycle
题目地址:http://oj.leetcode.com/problems/linked-list-cycle/ 解法:没有说不可以改变节点里的值,所以我是对每个经过的节点里的变量val,赋予一个特殊值,然后通过判断是否会遇到这个特殊值来判断是否存在环。 ** * Definition for singly-linked list. * struct ListNode原创 2014-02-20 20:20:56 · 504 阅读 · 0 评论 -
【LeetCode】Binary Tree Preorder Traversal
地址:http://oj.leetcode.com/problems/binary-tree-preorder-traversal/ Binary Tree Preorder Traversal Total Accepted: 9880 Total Submissions: 28874My Submissions Given a binary tre原创 2014-02-20 21:47:07 · 530 阅读 · 0 评论 -
【UVaOJ】712 - S-Trees
S-Trees A Strange Tree (S-tree) over the variable set is a binary tree representing a Boolean function . Each path of the S-tree begins at the root node and consists of n+1 nodes. E原创 2014-01-06 20:49:52 · 648 阅读 · 0 评论 -
【UVaOJ】196 - Spreadsheet
Spreadsheet In 1979, Dan Bricklin and Bob Frankston wrote VisiCalc, the first spreadsheet application. It became a huge success and, at that time, was the killer application for the Apple原创 2014-01-05 17:19:47 · 772 阅读 · 0 评论 -
【UVaOJ】 657 - The die is cast
InterGames is a high-tech startup company that specializes in developing technology that allows users to play games over the Internet. A market analysis has alerted them to the fact that games of chan原创 2014-01-03 00:25:52 · 737 阅读 · 2 评论 -
【UVaOJ】 572 Oil Deposits
572 - Oil Deposits Time limit: 3.000 seconds The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular r原创 2013-12-25 13:22:30 · 647 阅读 · 0 评论 -
POJ——栈的基本操作(AC)
#include #include #define CAPACITY_DEFAULT 100 #define TEST_GROUP_MAX 100 typedef int ElementType; using namespace std; class Stack{ public: Stack(void){ top_ = 0; array = new Elemen原创 2013-11-12 20:22:05 · 943 阅读 · 0 评论 -
POJ——用队列对扑克牌排序(AC)
#define NDEBUG #include #include using namespace std; #define MAX_NUMBER 9 #define MAX_NODES 100 class Node{ public: int y; char x; }; class Queue{ public: Queue(){ head_ = -1; tail_原创 2013-11-12 20:20:32 · 1306 阅读 · 0 评论 -
POJ——字符串插入(AC)
次题比较简单,直接贴源码 /* ************************************************************************************************************************ 1. Description: There are two strings, named as “str” an原创 2013-11-12 00:16:18 · 731 阅读 · 0 评论 -
POJ——多项式加法(AC)
在失败了50次之后,终于在光棍节这一天AC了!因为这还错过了联谊会,想想还真是diao丝啊 其实这个题做出来之后想想还真不算是难题,《数据结构与算法分析——C语言描述》3.2 节"The List ADT" 就是以多项式加法为例子讲解的List的应用。 我最开始写的答案思路是:将每一组的两个多项式的系数和幂数,分别保存到两个结构体数组_array1和_array2中,一组输入完后利用qu原创 2013-11-11 21:54:29 · 3366 阅读 · 4 评论 -
POJ——多项式加法(WA)
下面是POJ上面的一道编程练习题,以及我写的答案,使用例程的输入还有自己的测试输入结果都是正确的,但是提交之后总是提示“Wrong Answer”,从昨晚改到现在一直不行,不知道到底错在哪里。。。。。。 ===================下面是题目======================================== 多项式加法 总时间限制:1000ms 内存限制:50原创 2013-10-23 21:37:55 · 3252 阅读 · 2 评论 -
[LeetCode] Evaluate Reverse Polish Notation
题目:http://oj.leetcode.com/problems/evaluate-reverse-polish-notation/ Evaluate Reverse Polish Notation Total Accepted: 5988 Total Submissions: 31842My Submissions Evaluate t原创 2014-02-21 00:19:08 · 604 阅读 · 0 评论 -
【LeetCode】Binary Tree Level Order Traversal
地址:http://oj.leetcode.com/problems/binary-tree-level-order-traversal/# Binary Tree Level Order Traversal Total Accepted: 7502 Total Submissions: 24956My Submissions Given a原创 2014-02-20 21:32:14 · 514 阅读 · 0 评论 -
【LeetCode】Best Time to Buy and Sell Stock II
https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/ 每笔赚钱交易都做:原创 2014-09-23 18:51:29 · 510 阅读 · 0 评论
分享