![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
文章平均质量分 71
kingofstorm7
研究生
展开
-
Leetcode283 Move Zeros
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. For example, given nums = [0, 1, 0, 3, 12], after calling you原创 2016-03-02 20:39:58 · 168 阅读 · 0 评论 -
Leetcode123123. Best Time to Buy and Sell Stock III
此题限制交易次数为2次。 Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactio原创 2016-03-11 09:37:01 · 174 阅读 · 0 评论 -
Leetcode122. Best Time to Buy and Sell Stock II
Leetcode122. Best Time to Buy and Sell Stock II: 给你每天的股票价格,可以多次交易,求最大收益,当然前提是先买后卖! Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm原创 2016-03-10 22:03:23 · 152 阅读 · 0 评论 -
Leecode121. Best Time to Buy and Sell Stock
Leecode121. 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原创 2016-03-10 21:59:35 · 214 阅读 · 0 评论 -
二叉树的后续遍历
Leetcode145. Binary Tree Postorder Traversal 给定使用数组保存的二叉树,返回其后续遍历 Given a binary tree, return the postorder traversal of its nodes' values. For example: Given binary tree {1,#,2,3},原创 2016-03-10 21:55:00 · 367 阅读 · 0 评论 -
232. Implement Queue using Stacks
题目:232. Implement Queue using Stacks Difficulty: Easy 使用堆实现队列 Implement the following operations of a queue using stacks. push(x) -- Push element x to the原创 2016-03-10 10:28:44 · 139 阅读 · 0 评论 -
Leetcode299. Bulls and Cows
题目: You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provide原创 2016-03-08 17:12:15 · 189 阅读 · 0 评论 -
Leetcode13. Roman to Integer
Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. Subscribe to see which companies asked this question C++代码: int romanToInt(原创 2016-03-03 21:21:24 · 167 阅读 · 0 评论 -
Leetcode263. Ugly Number
Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly sinc原创 2016-03-03 21:13:19 · 155 阅读 · 0 评论 -
Leetcode217. Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is原创 2016-03-03 16:55:56 · 182 阅读 · 0 评论 -
Leetcode171. Excel Sheet Column Number
Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: A -> 1 B -> 2 C -> 3 ...原创 2016-03-03 16:47:57 · 146 阅读 · 0 评论 -
Leetcode242. Valid Anagram
题目: Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = "anagram", t = "nagaram", return true. s = "rat", t = "car", return false. Note: You原创 2016-03-03 16:44:50 · 208 阅读 · 0 评论 -
Leetcode128 题目总结(hard)
the first missing positive : 从1开始寻找正整数i,找到就把他交换到nums[i]: class Solution { public: int firstMissingPositive(vector& nums) { int result = 1; for (int i = 0; i < nums.size();原创 2016-03-11 09:04:06 · 330 阅读 · 0 评论