随笔分类 - Leetcode刷题
Leetcode 55
摘要:class Solution: def canJump(self, nums: List[int]) -> bool: if len(nums) == 1:return True i = 0;j = i for i in range(100000): if j > i+nums[i]:pass el
阅读全文
Leetcode457
摘要:A very absurd description for this problem, but people can get the idea by looking at the examples.... bool circularArrayLoop(vector<int>& nums) { int
阅读全文
132pattern-Leetcode456
摘要:QUESTION: To search for a subsequence (s1,s2,s3) such that s1 < s3 < s2. INTUITION: Suppose we want to find a 123 sequence with s1 < s2 < s3, we just
阅读全文
Leetcode209
摘要:209. Minimum Size Subarray Sum i , s , l = 0, 0, 0 for j in range(len(nums)): s += nums[j] while (s >= target): l = j-i+1 if l == 0 else min(j-i+1, l)
阅读全文
Leetcode203
摘要:题意:去掉给定头ListNode* head 的单链表内 val 等于一个 给定val的节点并返回头 思路:此题删除链表中元素是很简单的,只需要让待删节点之前一个节点指向待删节点之后一个节点即可。 此题最大的问题就是,题目要求我们要返回新链表中的头结点,如果我们就采用仅仅复制头结点的方式(用H=he
阅读全文
Leetcode 199
摘要:199. Binary Tree Right Side View Given the root of a binary tree, imagine yourself standing on the right side of it, return the values of the nodes yo
阅读全文
Leetcode207
摘要:numCourses->总的课程数目 Prerequisited->pair in a list denoting have to finish b to study a class Solution: def canFinish(self, numCourses: int, prerequisit
阅读全文
Leetcode61
摘要:!!Given the head of a linked list, rotate the list to the right by k places.!! # Definition for singly-linked list. # class ListNode(object): # def __
阅读全文
浙公网安备 33010602011771号