Loading

摘要: Given an n x n matrix where each of the rows and columns is sorted in ascending order, return the kth smallest element in the matrix. Note that it is 阅读全文
posted @ 2021-11-19 21:51 aalanwyr 阅读(20) 评论(0) 推荐(0) 编辑
摘要: You are given an integer array nums of length n where nums is a permutation of the numbers in the range [0, n - 1]. You should build a set s[k] = {num 阅读全文
posted @ 2021-11-19 21:49 aalanwyr 阅读(20) 评论(0) 推荐(0) 编辑
摘要: Suppose an array of length n sorted in ascending order is rotated between 1 and n times. For example, the array nums = [0,1,2,4,5,6,7] might become: [ 阅读全文
posted @ 2021-11-19 21:44 aalanwyr 阅读(30) 评论(0) 推荐(0) 编辑
摘要: You are given an m x n matrix M initialized with all 0's and an array of operations ops, where ops[i] = [ai, bi] means M[x][y] should be incremented b 阅读全文
posted @ 2021-11-19 21:33 aalanwyr 阅读(33) 评论(0) 推荐(0) 编辑
摘要: Given a non-negative integer c, decide whether there're two integers a and b such that a2 + b2 = c. 只要是two_sum 变形 都可以考虑用hash_set来做。 class Solution { p 阅读全文
posted @ 2021-11-19 21:30 aalanwyr 阅读(35) 评论(0) 推荐(0) 编辑
摘要: Design and implement a TwoSum class. It should support the following operations: add and find. add - Add the number to an internal data structure. fin 阅读全文
posted @ 2021-11-19 21:27 aalanwyr 阅读(23) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each inp 阅读全文
posted @ 2021-11-19 21:26 aalanwyr 阅读(18) 评论(0) 推荐(0) 编辑
摘要: Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific targe 阅读全文
posted @ 2021-11-19 21:23 aalanwyr 阅读(24) 评论(0) 推荐(0) 编辑
摘要: Given the root of a Binary Search Tree and a target number k, return true if there exist two elements in the BST such that their sum is equal to the g 阅读全文
posted @ 2021-11-19 21:12 aalanwyr 阅读(21) 评论(0) 推荐(0) 编辑
摘要: Share Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules: Each row must contain t 阅读全文
posted @ 2021-11-19 21:03 aalanwyr 阅读(40) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers nums, half of the integers in nums are odd, and the other half are even. Sort the array so that whenever nums[i] is odd, i  阅读全文
posted @ 2021-11-19 20:49 aalanwyr 阅读(20) 评论(0) 推荐(0) 编辑
摘要: One way to serialize a binary tree is to use preorder traversal. When we encounter a non-null node, we record the node's value. If it is a null node, 阅读全文
posted @ 2021-11-19 20:31 aalanwyr 阅读(33) 评论(0) 推荐(0) 编辑
摘要: Given a string s, reverse the string according to the following rules: All the characters that are not English letters remain in the same position. Al 阅读全文
posted @ 2021-11-19 20:23 aalanwyr 阅读(28) 评论(0) 推荐(0) 编辑
摘要: Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string. Note: You mus 阅读全文
posted @ 2021-11-19 17:26 aalanwyr 阅读(44) 评论(0) 推荐(0) 编辑
摘要: There is an undirected connected tree with n nodes labeled from 0 to n - 1 and n - 1 edges. You are given the integer n and the array edges where edge 阅读全文
posted @ 2021-11-19 17:13 aalanwyr 阅读(50) 评论(0) 推荐(0) 编辑
摘要: Given an m x n board of characters and a list of strings words, return all words on the board. Each word must be constructed from letters of sequentia 阅读全文
posted @ 2021-11-19 17:03 aalanwyr 阅读(30) 评论(0) 推荐(0) 编辑
摘要: Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequent 阅读全文
posted @ 2021-11-19 16:53 aalanwyr 阅读(33) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 to n. 一般如果只 阅读全文
posted @ 2021-11-19 16:47 aalanwyr 阅读(23) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, return all the structurally unique BST's (binary search trees), which has exactly n nodes of unique values from 1 to n. Return the 阅读全文
posted @ 2021-11-19 16:26 aalanwyr 阅读(19) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers preorder, which represents the preorder traversal of a BST (i.e., binary search tree), construct the tree and return its ro 阅读全文
posted @ 2021-11-19 16:22 aalanwyr 阅读(21) 评论(0) 推荐(0) 编辑