自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(9)
  • 收藏
  • 关注

转载 23. Merge k Sorted Lists

/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: ListNode* ...

2019-06-01 23:30:52 56

原创 397. Integer Replacement

https://leetcode.com/problems/integer-replacement/description/ class Solution {public: int integerReplacement(int n) { if (n==1){ return 0; } if (n%2 == ...

2018-10-12 11:43:56 78

原创 35. Search Insert Position

https://leetcode.com/problems/search-insert-position/description/class Solution {public: int searchInsert(vector<int>& nums, int target) { int i; for(i=0;i<nums.si...

2018-10-12 11:42:42 78

原创 238. Product of Array Except Self

https://leetcode.com/problems/product-of-array-except-self/description/两个vector,一个记录当前位置前面所有的乘积,一个记录之后所有的成绩,然后把两个vector当前位置的值乘起来就可以了。class Solution {public: vector<int> productExceptSe...

2018-10-12 11:41:19 71

原创 445. Add Two Numbers II

https://leetcode.com/problems/add-two-numbers-ii/description/Linked List + Stack;最后的操作有点tricky/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *nex...

2018-10-12 11:39:09 97

原创 Leetcode 458 Poor Pigs

可怜的猪 class Solution {public:    int poorPigs(int buckets, int minutesToDie, int minutesToTest) {        int pigs = 0;        while (pow((minutesToTest / minutesToDie + 1), pigs) < buckets) ...

2018-10-12 11:37:21 67

原创 LeetCode 678. Valid Parenthesis String

题目:Given a string containing only three types of characters: '(', ')' and '*', write a function to check whether this string is valid. We define the validity of a string by these rules:Any left pa...

2018-07-31 10:53:28 158

原创 LeetCode 63. Unique Paths II Python Solution

题目:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is trying to reach t...

2018-07-30 17:58:39 84

原创 LeetCode 102. Binary Tree Level Order Traversal

题目:Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 ...

2018-07-30 17:36:43 80

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除