自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(14)
  • 收藏
  • 关注

原创 [Tree]Leetcode 105. Construct Binary Tree from Preorder and Inorder Traversal

这道题是通过preorder和inorder的顺序来确认整个tree。思路:preorder: root, left, right; inorder: left, root, right。example: preorder = [3,9,20,15,7], inorder = [9,3,15,20,7];preorder第一个一定是root,记录下root的值,在inorder里面找到root对应的index,那么root的左边就是左子树,root的右边就是右子树。recurively找到r

2022-01-30 10:28:37 417

原创 Twitter 下载遇到的问题

1.Error: jupyterlab-server 1.0.0 has requirement jsonschema>=3.0.1, but you'll have jsonschema 2.6.0 which is incompatible.解决方法:在终端输入conda install -c anaconda jsonschemaReference:https://stackoverflow.com/questions/55682050/jsonschema-2-6-0-is-.

2021-03-18 09:26:50 3123

原创 [MergeSort]LintCode463. Sort Integers

public class Solution { public void sortIntegers(int[] A) { if (A == null || A.length == 0) { return; } int[] temp = new int[A.length]; mergeSort(A, 0, A.length - 1, temp); } private void mergeSo

2021-02-11 12:11:11 165

原创 [QuickSort]LintCode463. Sort Integers

463. Sort IntegersGiven an integer array, sort it in ascending order. Use selection sort, bubble sort, insertion sort or any O(n2) algorithm.样例Example 1:Input: [3, 2, 1, 4, 5]Output: [1, 2, 3, 4, 5]Explanation: return the sorted array.Example 2:

2021-02-08 09:25:22 90

原创 [TwoPointers][2]Lintcode587. Two Sum - Unique pairs

Amazon | OA 2019 | Two Sum - Unique PairsGiven an int array nums and an int target, find how many unique pairs in the array such that their sum is equal to target. Return the number of pairs.Example 1:Input: nums = [1, 1, 2, 45, 46, 46], target = 47Out

2021-02-01 03:27:37 192

原创 [Two Pointers][1]Leetcode170. Two Sum III - Data structure design

Leetcode170. Two Sum III - Data structure designSolution1: HashMapclass TwoSum { private HashMap<Integer, Integer> map; /** Initialize your data structure here. */ public TwoSum() { map = new HashMap<>(); }

2021-01-31 23:48:07 101

原创 [String][6]Lintcode1790. Rotate String II

Lintcode 1790. Rotate String II描述Given a string(Given in the way of char array), a right offset and a left offset, move the string according to the given offset and save it in a new result set. (left offest represents the offset of a string to the left,r

2021-01-31 09:03:00 90

原创 [String][3]Leetcode125. Valid Palindrome

125. Valid PalindromeGiven a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.Note: For the purpose of this problem, we define empty string as valid palindrome.Example 1:Input: "A man, a plan, a canal

2021-01-30 23:52:06 86

原创 [String][2]Leetcode28. Implement strStr()

Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Clarification:What should we return when needle is an empty string? This is a great question to ask during an interview.For the p

2021-01-30 11:16:24 61

原创 BinarySearch[5]34. Find First and Last Position of Element in Sorted Array

Thoughts:The main problem , is to solve the condition that mid == target.If mid == target, we need find the range of the target.So how to find the range of the target?1.Binary Search Solution1Problem: too many codes.class Solution { public int[]

2021-01-21 11:59:50 83

原创 BinarySearch[4]153. Find Minimum in Rotated Sorted Array

1.Simple Easy Thinking SolutionBinary SearchTime Complexity: O(logn)class Solution { public int findMin(int[] nums) { // The difference between 33. Search in Rotated Sorted Array and this one is: // This question find the mim and the o

2021-01-21 04:18:38 103

原创 BinarySearch[3]Leetcode852. Peak Index in a Mountain Array

Description[Easy]Let’s call an array arra mountain if the following properties hold:arr.length >= 3There exists some i with 0 < i < arr.length - 1 such that:arr[0] < arr[1] < ... arr[i-1] < arr[i]arr[i] > arr[i+1] > ... >

2021-01-20 23:13:38 135 1

原创 Mac解决sublime Text3 package control出现There are no packages available for installation

打开Mac Sublime Text3 , Package Control出现There are no packages available for installation。解决办法:1.打开Sublime Text 3软件,选择Preference -> Package Settings ->Package Control -> Settings-User2.打开P...

2019-04-02 19:17:14 1247

原创 Mac 安装sublime Text3里面的package control 各种错误示范

Mac 安装sublime Text3里面的package control前期工作:自行在网上下载sublime Text3破解版,安装package control错误示范错误示范1:按照网友提供的步骤:1、点击[View]->[Show Console],打开sublime控制台;2、在Console中输入以下代码后回车:import urllib.request,os;...

2019-03-31 12:14:49 1113

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除