随笔分类 -  leetcode(python)

记录自己学习python做leetcode的一些问题
摘要:Given the root of a tree, you are asked to find the most frequent subtree sum. The subtree sum of a node is defined as the sum of all the node values 阅读全文

posted @ 2020-11-07 17:17 actor_spider 阅读(52) 评论(0) 推荐(0) |

摘要:Given a list of directory info including directory path, and all the files with contents in this directory, you need to find out all the groups of dup 阅读全文

posted @ 2020-11-07 16:17 actor_spider 阅读(90) 评论(0) 推荐(0) |

摘要:Implement FreqStack, a class which simulates the operation of a stack-like data structure. FreqStack has two functions: push(int x), which pushes an i 阅读全文

posted @ 2020-11-06 10:59 actor_spider 阅读(113) 评论(0) 推荐(0) |

摘要:Given a matrix consisting of 0s and 1s, we may choose any number of columns in the matrix and flip every cell in that column. Flipping a cell changes 阅读全文

posted @ 2020-11-04 20:16 actor_spider 阅读(88) 评论(0) 推荐(0) |

摘要:Given a non-empty array of integers, return the k most frequent elements. 输入输出实例: Input: nums = [1,1,1,2,2,3], k = 2 Output: [1,2] 本题比较简单,就输出出现的最频繁的k个 阅读全文

posted @ 2020-11-04 19:37 actor_spider 阅读(52) 评论(0) 推荐(0) |

摘要:Given a string, sort it in decreasing order based on the frequency of characters. 输入输出实例: Input: "tree" Output: "eert" Explanation: 'e' appears twice 阅读全文

posted @ 2020-11-03 21:00 actor_spider 阅读(86) 评论(0) 推荐(0) |

摘要:Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warme 阅读全文

posted @ 2020-11-03 20:39 actor_spider 阅读(51) 评论(0) 推荐(0) |

摘要:Given the root of a binary tree, return the inorder traversal of its nodes' values. 示例: Input: root = [1,null,2,3] Output: [1,3,2] 本题就是一个简单的中序遍历二叉树 1 阅读全文

posted @ 2020-11-03 19:46 actor_spider 阅读(48) 评论(0) 推荐(0) |

摘要:Given the array orders, which represents the orders that customers have done in a restaurant. More specifically orders[i][customerNamei,tableNumberi,f 阅读全文

posted @ 2020-11-03 19:38 actor_spider 阅读(187) 评论(0) 推荐(0) |

摘要:Given a binary tree with the following rules: root.val == 0 If treeNode.val == x and treeNode.left != null, then treeNode.left.val == 2 * x + 1 If tre 阅读全文

posted @ 2020-11-02 20:58 actor_spider 阅读(108) 评论(0) 推荐(0) |

摘要:题目: In a array A of size 2N, there are N+1 unique elements, and exactly one of these elements is repeated N times. Return the element repeated N times 阅读全文

posted @ 2020-11-02 19:56 actor_spider 阅读(65) 评论(0) 推荐(0) |

摘要:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum pro 阅读全文

posted @ 2020-11-01 21:29 actor_spider 阅读(56) 评论(0) 推荐(0) |

摘要:Given the array nums consisting of n positive integers. You computed the sum of all non-empty continous subarrays from the array and then sort them in 阅读全文

posted @ 2020-11-01 21:14 actor_spider 阅读(96) 评论(0) 推荐(0) |

摘要:Given an integer k, return the minimum number of Fibonacci numbers whose sum is equal to k. The same Fibonacci number can be used multiple times. The 阅读全文

posted @ 2020-11-01 20:44 actor_spider 阅读(91) 评论(0) 推荐(0) |

摘要:Given a non-empty 2D array grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.) Yo 阅读全文

posted @ 2020-11-01 20:28 actor_spider 阅读(50) 评论(0) 推荐(0) |

摘要:There is a room with n bulbs, numbered from 1 to n, arranged in a row from left to right. Initially, all the bulbs are turned off.At moment k (for k f 阅读全文

posted @ 2020-11-01 19:59 actor_spider 阅读(71) 评论(0) 推荐(0) |

摘要:题目: Given an array arr. You can choose a set of integers and remove all the occurrences of these integers in the array. Return the minimum size of the 阅读全文

posted @ 2020-11-01 19:28 actor_spider 阅读(53) 评论(0) 推荐(0) |

博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3