12 2020 档案

摘要:Implement pow(x, n), which calculates x raised to the power n (i.e. xn). 方法一: 递归 public double quickMul(double x, long N) { if (N == 0) { return 1.0; 阅读全文
posted @ 2020-12-23 14:12 diameter 阅读(58) 评论(0) 推荐(0) 编辑
摘要:Given an array of strings strs, group the anagrams together. You can return the answer in any order. An Anagram is a word or phrase formed by rearrang 阅读全文
posted @ 2020-12-23 13:57 diameter 阅读(70) 评论(0) 推荐(0) 编辑
摘要:You are given an n x n 2D matrix representing an image, rotate the image by 90 degrees (clockwise). You have to rotate the image in-place, which means 阅读全文
posted @ 2020-12-23 13:38 diameter 阅读(106) 评论(0) 推荐(0) 编辑
摘要:Given a collection of numbers, nums, that might contain duplicates, return all possible unique permutations in any order. 方法: 回溯法,去重 boolean[] vis; pu 阅读全文
posted @ 2020-12-23 13:34 diameter 阅读(58) 评论(0) 推荐(0) 编辑
摘要:Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. 方法 : 回溯法。 public List<List<Int 阅读全文
posted @ 2020-12-23 13:18 diameter 阅读(86) 评论(0) 推荐(0) 编辑
摘要:Given an array of non-negative integers nums, you are initially positioned at the first index of the array. Each element in the array represents your 阅读全文
posted @ 2020-12-23 11:21 diameter 阅读(80) 评论(0) 推荐(0) 编辑
摘要:Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for '?' and '*' where: '?' Matches any single character. 阅读全文
posted @ 2020-12-23 10:16 diameter 阅读(117) 评论(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 @ 2020-12-22 19:00 diameter 阅读(93) 评论(0) 推荐(0) 编辑
摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it can trap after raining. Input: 阅读全文
posted @ 2020-12-20 09:37 diameter 阅读(116) 评论(0) 推荐(0) 编辑
摘要:Given an unsorted integer array nums, find the smallest missing positive integer. Follow up: Could you implement an algorithm that runs in O(n) time a 阅读全文
posted @ 2020-12-19 20:42 diameter 阅读(74) 评论(0) 推荐(0) 编辑
摘要:Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numb 阅读全文
posted @ 2020-12-19 16:32 diameter 阅读(99) 评论(0) 推荐(0) 编辑
摘要:Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen nu 阅读全文
posted @ 2020-12-18 16:41 diameter 阅读(90) 评论(0) 推荐(0) 编辑
摘要:The count-and-say sequence is a sequence of digit strings defined by the recursive formula: countAndSay(1) = "1" countAndSay(n) is the way you would " 阅读全文
posted @ 2020-12-18 15:34 diameter 阅读(81) 评论(0) 推荐(0) 编辑
摘要:Write a program to solve a Sudoku puzzle by filling the empty cells. A sudoku solution must satisfy all of the following rules: Each of the digits 1-9 阅读全文
posted @ 2020-12-18 14:44 diameter 阅读(77) 评论(0) 推荐(0) 编辑
摘要: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 the dig 阅读全文
posted @ 2020-12-17 17:34 diameter 阅读(99) 评论(0) 推荐(0) 编辑
摘要:Given a sorted array of distinct integers and a target value, return the index if the target is found. If not, return the index where it would be if i 阅读全文
posted @ 2020-12-17 14:55 diameter 阅读(69) 评论(0) 推荐(0) 编辑
摘要:Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. If target is not found in th 阅读全文
posted @ 2020-12-17 14:22 diameter 阅读(76) 评论(0) 推荐(0) 编辑
摘要:You are given an integer array nums sorted in ascending order, and an integer target. Suppose that nums is rotated at some pivot unknown to you before 阅读全文
posted @ 2020-12-17 10:43 diameter 阅读(87) 评论(0) 推荐(0) 编辑
摘要:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring. Input: s = "(()"O 阅读全文
posted @ 2020-12-16 19:16 diameter 阅读(95) 评论(0) 推荐(0) 编辑
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such an arrangement is not pos 阅读全文
posted @ 2020-12-14 17:23 diameter 阅读(69) 评论(0) 推荐(0) 编辑
摘要:You are given a string s and an array of strings words of the same length. Return all starting indices of substring(s) in s that is a concatenation of 阅读全文
posted @ 2020-12-13 21:15 diameter 阅读(88) 评论(0) 推荐(0) 编辑
摘要:Given two integers dividend and divisor, divide two integers without using multiplication, division, and mod operator. Return the quotient after divid 阅读全文
posted @ 2020-12-11 21:02 diameter 阅读(96) 评论(0) 推荐(0) 编辑
摘要:Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Clarification: What shoul 阅读全文
posted @ 2020-12-11 15:47 diameter 阅读(76) 评论(0) 推荐(0) 编辑
摘要:Given an array nums and a value val, remove all instances of that value in-place and return the new length. Do not allocate extra space for another ar 阅读全文
posted @ 2020-12-10 18:27 diameter 阅读(137) 评论(0) 推荐(0) 编辑
摘要:Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length. Do not allocate extra s 阅读全文
posted @ 2020-12-09 22:16 diameter 阅读(57) 评论(0) 推荐(0) 编辑
摘要:Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. k is a positive integer and is less than or equal to 阅读全文
posted @ 2020-12-09 19:19 diameter 阅读(78) 评论(0) 推荐(0) 编辑
摘要:Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes. Only nodes itself may be ch 阅读全文
posted @ 2020-12-07 18:40 diameter 阅读(98) 评论(0) 推荐(0) 编辑
摘要:You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list 阅读全文
posted @ 2020-12-07 17:58 diameter 阅读(96) 评论(0) 推荐(0) 编辑
摘要:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Input: n = 3Output: ["((()))","(()())","(())() 阅读全文
posted @ 2020-12-06 11:54 diameter 阅读(97) 评论(0) 推荐(0) 编辑
摘要:Merge two sorted linked lists and return it as a new sorted list. The new list should be made by splicing together the nodes of the first two lists. I 阅读全文
posted @ 2020-12-04 14:51 diameter 阅读(102) 评论(0) 推荐(0) 编辑
摘要:Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: 阅读全文
posted @ 2020-12-04 11:01 diameter 阅读(115) 评论(0) 推荐(0) 编辑
摘要:算法定义: 编写一段计算机程序一般都是实现一种已有的方法来解决某个问题。 这种方法大多和使用的编程语言无关--它适用于各种计算机以及编程语言。是这种方法而非计算机程序本身描述来解决问题的步骤。在计算机科学领域,我们用算法这个词来描述一种有限、确定、有效的并适合用计算机程序来实现的解决问题的方法。 我 阅读全文
posted @ 2020-12-03 18:12 diameter 阅读(82) 评论(0) 推荐(0) 编辑
摘要:Given the head of a linked list, remove the nth node from the end of the list and return its head. Follow up: Could you do this in one pass? Input: he 阅读全文
posted @ 2020-12-03 14:38 diameter 阅读(72) 评论(0) 推荐(0) 编辑
摘要:Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c+ d = target? Find all unique qu 阅读全文
posted @ 2020-12-03 11:49 diameter 阅读(78) 评论(0) 推荐(0) 编辑
摘要:Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. Return the answer in any 阅读全文
posted @ 2020-12-02 13:39 diameter 阅读(174) 评论(0) 推荐(0) 编辑
摘要:Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the thr 阅读全文
posted @ 2020-12-02 10:18 diameter 阅读(87) 评论(0) 推荐(0) 编辑
摘要:Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the s 阅读全文
posted @ 2020-12-01 18:28 diameter 阅读(89) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示