随笔分类 -  leetcode

1 2 3 4 5 ··· 17 下一页
https://leetcode.com/problemset/all/
摘要:A cinema has n rows of seats, numbered from 1 to n and there are ten seats in each row, labelled from 1 to 10 as shown in the figure above. Given the 阅读全文
posted @ 2022-12-27 18:10 bernieloveslife 阅读(75) 评论(0) 推荐(0)
摘要:Given the root of a binary tree, return the sum of all left leaves. A leaf is a node with no children. A left leaf is a leaf that is the left child of 阅读全文
posted @ 2022-12-27 17:34 bernieloveslife 阅读(21) 评论(0) 推荐(0)
摘要:「句子」是一个用空格分隔单词的字符串。给你一个满足下述格式的句子 text : 句子的首字母大写 text 中的每个单词都用单个空格分隔。 请你重新排列 text 中的单词,使所有单词按其长度的升序排列。如果两个单词的长度相同,则保留其在原句子中的相对顺序。 请同样按上述格式返回新的句子。 示例 1 阅读全文
posted @ 2022-03-31 11:19 bernieloveslife 阅读(94) 评论(0) 推荐(0)
摘要:给你二叉树的根节点 root ,返回它节点值的 前序 遍历。 示例 1: 输入:root = [1,null,2,3] 输出:[1,2,3] 示例 2: 输入:root = [] 输出:[] 示例 3: 输入:root = [1] 输出:[1] 示例 4: 输入:root = [1,2] 输出:[1 阅读全文
posted @ 2022-03-31 11:15 bernieloveslife 阅读(25) 评论(0) 推荐(0)
摘要:You are given a sorted unique integer array nums. Return the smallest sorted list of ranges that cover all the numbers in the array exactly. That is, 阅读全文
posted @ 2020-12-09 22:41 bernieloveslife 阅读(72) 评论(0) 推荐(0)
摘要:Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. Example: Input: 1 0 1 0 0 1 0 1 1 1 阅读全文
posted @ 2019-07-12 20:34 bernieloveslife 阅读(127) 评论(0) 推荐(0)
摘要:A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy 阅读全文
posted @ 2019-01-14 16:00 bernieloveslife 阅读(124) 评论(0) 推荐(0)
摘要:You are standing at position 0 on an infinite number line. There is a goal at position target. On each move, you can either go left or right. During t 阅读全文
posted @ 2019-01-13 16:55 bernieloveslife 阅读(152) 评论(0) 推荐(0)
摘要:Write a SQL query to get the second highest salary from the Employee table. For example, given the above Employee table, the query should return 200 a 阅读全文
posted @ 2019-01-13 16:34 bernieloveslife 阅读(108) 评论(0) 推荐(0)
摘要:Table: Person Table: Address Write a SQL query for a report that provides the following information for each person in the Person table, regardless if 阅读全文
posted @ 2019-01-13 16:33 bernieloveslife 阅读(101) 评论(0) 推荐(0)
摘要:Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id. For example, aft 阅读全文
posted @ 2019-01-13 16:30 bernieloveslife 阅读(127) 评论(0) 推荐(0)
摘要:Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash script to print all valid phone numbers. You may 阅读全文
posted @ 2019-01-13 16:25 bernieloveslife 阅读(128) 评论(0) 推荐(0)
摘要:Given two strings A and B, find the minimum number of times A has to be repeated such that B is a substring of it. If no such solution, return 1. For 阅读全文
posted @ 2019-01-09 17:34 bernieloveslife 阅读(103) 评论(0) 推荐(0)
摘要:Sort a linked list in O(n log n) time using constant space complexity. Example 1: Input: 4 2 1 3 Output: 1 2 3 4 Example 2: Input: 1 5 3 4 0 Output: 1 阅读全文
posted @ 2019-01-09 17:12 bernieloveslife 阅读(103) 评论(0) 推荐(0)
摘要:Sort a linked list using insertion sort. A graphical example of insertion sort. The partial sorted list (black) initially contains only the first elem 阅读全文
posted @ 2019-01-09 16:57 bernieloveslife 阅读(107) 评论(0) 推荐(0)
摘要:Winter is coming! Your first job during the contest is to design a standard heater with fixed warm radius to warm all the houses. Now, you are given p 阅读全文
posted @ 2019-01-09 16:14 bernieloveslife 阅读(176) 评论(0) 推荐(0)
摘要:Given two strings A and B of lowercase letters, return true if and only if we can swap two letters in A so that the result equals B. Example 1: Exampl 阅读全文
posted @ 2019-01-08 18:11 bernieloveslife 阅读(139) 评论(0) 推荐(0)
摘要:A game on an undirected graph is played by two players, Mouse and Cat, who alternate turns. The graph is given as follows: graph[a] is a list of all n 阅读全文
posted @ 2019-01-08 14:47 bernieloveslife 阅读(260) 评论(0) 推荐(0)
摘要:Given an array of characters, compress it in place. The length after compression must always be smaller than or equal to the original array. Every ele 阅读全文
posted @ 2019-01-07 21:42 bernieloveslife 阅读(103) 评论(0) 推荐(0)
摘要:Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: "Gold Medal", "Sil 阅读全文
posted @ 2019-01-07 21:21 bernieloveslife 阅读(93) 评论(0) 推荐(0)

1 2 3 4 5 ··· 17 下一页