- 博客(71)
- 资源 (3)
- 收藏
- 关注
原创 Leetcode 46. Permutations
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solutionclass Solution {public: vector<vector<int>> permute(vector<int>& nums) ...
2018-08-31 19:22:08 170
原创 Leetcode 31. Next Permutation
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solutionclass Solution {public: void nextPermutation(vector<int>& nums) { int index...
2018-08-31 19:20:50 138
原创 Leetcode 60. Permutation Sequence
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solutionclass Solution {public: string getPermutation(int n, int k) { string result; ...
2018-08-31 19:20:25 150
原创 Leetcode 441. Arranging Coins
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solutionclass Solution {public: int arrangeCoins(int n) { int k = 0; while(n > 0) ...
2018-08-31 19:19:59 248
原创 Leetcode 703. Kth Largest Element in a Stream
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class KthLargest {public: KthLargest(int k, vector<int> nums) { th...
2018-08-30 19:03:59 445
原创 Leetcode 703. Kth Largest Element in a Stream
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class KthLargest {public: KthLargest(int k, vector<int> nums) { th...
2018-08-30 19:03:30 536
原创 Leetcode 690. Employee Importance
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionNon-recurrent/*// Employee infoclass Employee {public: // It's the unique ID of each no...
2018-08-30 19:03:08 188
原创 Leetcode 222. Count Complete Tree Nodes
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solution/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *le...
2018-08-30 19:02:34 145
原创 Leetcode 430. Flatten a Multilevel Doubly Linked List
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solution/*// Definition for a Node.class Node {public: int val = NULL; Node* prev = NULL; N...
2018-08-29 19:08:47 677
原创 Leetcode 114. Flatten Binary Tree to Linked List
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solution/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *le...
2018-08-29 19:08:21 179
原创 Leetcode 106. Construct Binary Tree from Inorder and Postorder Traversal
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solution/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *le...
2018-08-29 19:07:49 229
原创 Leetcode 105. Construct Binary Tree from Preorder and Inorder Traversal
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solution/** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *le...
2018-08-29 19:07:05 254
原创 Leetcode 532. K-diff Pairs in an Array
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int findPairs(vector<int>& nums, int k) { ...
2018-08-28 19:17:01 259
原创 Leetcode 530. Minimum Absolute Difference in BST
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1/** * Definition for a binary tree node. * struct TreeNode { * int val; * ...
2018-08-28 19:16:35 248
原创 Leetcode 581. Shortest Unsorted Continuous Subarray
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int findUnsortedSubarray(vector<int>& nums) {...
2018-08-28 19:14:59 152
原创 Leetcode 414. Third Maximum Number
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int thirdMax(vector<int>& nums) { long...
2018-08-27 18:57:43 265
原创 Leetcode 215. Kth Largest Element in an Array
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int findKthLargest(vector<int>& nums, int k) {...
2018-08-27 18:57:19 209
原创 Leetcode 347. Top K Frequent Elements
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1bool compare(const pair<int, int> &a, const pair<int, int> &b) {...
2018-08-27 18:56:54 323
原创 Leetcode 313. Super Ugly Number
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solutionclass Solution {public: int nthSuperUglyNumber(int n, vector<int>& primes) { ...
2018-08-27 18:56:29 403
原创 Leetcode 747. Largest Number At Least Twice of Others
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int dominantIndex(vector<int>& nums) { ...
2018-08-23 19:05:44 173
原创 Leetcode 852. Peak Index in a Mountain Array
文章作者:Tyan 博客:noahsnail.com &nbsp;|&nbsp; CSDN &nbsp;|&nbsp; 简书1. Description2. Solutionclass Solution {public: int peakIndexInMountainArray(vector&lt;int&gt;&amp; A) { int le
2018-08-23 19:05:15 243
原创 Leetcode 162. Find Peak Element
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int findPeakElement(vector<int>& nums) { ...
2018-08-23 19:04:50 261
原创 Leetcode 80. Remove Duplicates from Sorted Array II
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solutionclass Solution {public: int removeDuplicates(vector<int>& nums) { if(nums.s...
2018-08-23 19:04:20 141
原创 Leetcode 283. Move Zeroes
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: void moveZeroes(vector<int>& nums) { i...
2018-08-23 19:03:54 143
原创 Leetcode 237. Delete Node in a Linked List
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solution/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *ne...
2018-08-22 19:27:07 154
原创 Leetcode 203. Remove Linked List Elements
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1/** * Definition for singly-linked list. * struct ListNode { * int val; * ...
2018-08-22 19:00:32 148
原创 Leetcode 27. Remove Element
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int removeElement(vector<int>& nums, int val) ...
2018-08-22 18:38:41 143
原创 Leetcode 26. Remove Duplicates from Sorted Array
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int removeDuplicates(vector<int>& nums) { ...
2018-08-22 18:23:41 138
原创 Leetcode 448. Find All Numbers Disappeared in an Array
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: vector<int> findDisappearedNumbers(vector<int&g...
2018-08-22 18:23:16 138
原创 Leetcode 41. First Missing Positive
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int firstMissingPositive(vector<int>& nums) {...
2018-08-22 18:22:48 128
原创 Leetcode 551. Student Attendance Record I
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solutionclass Solution {public: bool checkRecord(string s) { int absent = 0; int late...
2018-08-21 18:46:57 301
原创 Leetcode 287. Find the Duplicate Number
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int findDuplicate(vector<int>& nums) { ...
2018-08-21 18:46:30 117
原创 Leetcode 268. Missing Number
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int missingNumber(vector<int>& nums) { ...
2018-08-21 18:46:06 113
原创 Leetcode 13. Roman to Integer
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solutionclass Solution {public: int romanToInt(string s) { map<char, int> values; ...
2018-08-21 18:45:13 153
原创 Leetcode 12. Integer to Roman
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solutionclass Solution {public: string intToRoman(int num) { const int TEN = 10; co...
2018-08-21 18:44:49 150
原创 Leetcode 264. Ugly Number II
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solutionclass Solution {public: int nthUglyNumber(int n) { if(n == 1) { return 1;...
2018-08-18 23:59:21 225
原创 Leetcode 258. Add Digits
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: int addDigits(int num) { int n = num; wh...
2018-08-17 19:03:15 152
原创 Leetcode 142. Linked List Cycle II
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solution/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *ne...
2018-08-17 18:48:32 171
原创 Leetcode 141. Linked List Cycle
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. Solution/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *ne...
2018-08-17 18:47:55 124
原创 Leetcode 202. Happy Number
文章作者:Tyan 博客:noahsnail.com | CSDN | 简书1. Description2. SolutionVersion 1class Solution {public: bool isHappy(int n) { int m = n; map<...
2018-08-17 18:47:32 174
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人