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)-- 数字排列的下一项
原题如下:
>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 中 Iterator 和 Enumeration 的区别
Java 中的
java.util.Iterator
和java.util.Enumeration
均可用来遍历 Java 中的集合框架(list,map,set 等)。
LeetCode 解题报告 (29)-- 通过加法完成除法
原题如下:
>Divide two integers without using multiplication, division and mod operator.If it is overflow, return MAX_INT.
LeetCode 解题报告 (27)-- 双指针找数组所有特定元素
原题如下:
>Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant memory.
LeetCode 解题报告 (26)-- 消除有序数组中重复值 (常数空间)
原题如下:
>Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.
Do not allocate extra space for another array, you must do this in place with constant memory.
0%