LeetCode 解题报告 (46,47)-- 排列
46. Permutations
原题如下:
Given a collection of distinct numbers, return all possible permutations.
原题如下:
Given a collection of distinct numbers, return all possible permutations.
原题如下 >Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.
原题如下:
Given an unsorted integer array, find the first missing positive integer.
LeetCode 解题报告 (39,40)-- 数字集合中找特定和
这两道题目 39. Combination Sum和 40. Combination Sum II均要求从给定的一个数字集合中找出若干个数字的和等于某个给定的数。解决方法有两种,第一种是回溯法,第二种是动态规划。下面分别讲述。
LeetCode 解题报告 (37)-- 回溯法解决数独问题
原题如下: >Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character '.'.
LeetCode 解题报告 (33,81,153,154)-- 二分搜索找旋转数组特定值
本文主要讲述如何在一个
Rotated Sorted Array
中找到特定的值,Rotated Sorted Array
指旋转了的数组,如4 5 6 7 0 1 2
就是0 1 2 4 5 6 7
的一个旋转数组。正常情况下遍历一遍即可,但是这样的时间复杂度为 \(O(n)\), 但是本文主要讲述通过二分查找将时间复杂度降到 \(O(log_2n)\)。LeetCode 解题报告 (32)-- 最长合法的子括号串
原题如下:
>Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.
LeetCode 解题报告 (31)-- 数字排列的下一项
发表于 标签 python原题如下:
>Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
LeetCode 解题报告 (30)-- 双指针找拼接子字符串
原题如下:
>You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and without any intervening characters.
Java 中 Hashtable 与 HashMap 的区别
发表于 标签 Java据说这是面试中被问频率非常高的一个问题,下面做简单的记录:
0%