06 2019 档案
摘要:1. 二分查找 非递归 递归 2. 变形 查找第一个值等于给定值的元素 3. 变形 查找最后一个值等于给定值的元素 4.变形 查找第一个大于等于给定值的元素 5. 变形 查找最后一个小于等于给定值的元素 上一个变形的结果-1,或使用 相关题 LeetCode704 - Binary Search h
        阅读全文
            
摘要:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or
        阅读全文
            
摘要:Given an array of integers nums sorted in ascending order, find the starting and ending position of a given target value. Your algorithm's runtime com
        阅读全文
            
摘要:Given a sorted (in ascending order) integer array nums of n elements and a targetvalue, write a function to search target in nums. If target exists, t
        阅读全文
            
摘要:题目描述 输入n个整数,找出其中最小的K个数。例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4个数字是1,2,3,4,。 最下topk,使用大顶堆 public ArrayList<Integer> GetLeastNumbers_Solution(int [] input, int k
        阅读全文
            
摘要:1. 前序遍历 (1)递归写法 (2)非递归写法 2.中序遍历 (1) 递归 (2)非递归 3.后序遍历 (1)递归 (2)非递归 4. 层次遍历 相关题 LeetCode144. Binary Tree Preorder Traversal LeetCode94. Binary Tree Inor
        阅读全文
            
摘要:Given an array of integers nums, sort the array in ascending order. Example 1: Example 2: Note: 排序 参考https://www.cnblogs.com/zhacai/p/11011961.html
        阅读全文
            
摘要:1. 自己的写法, 不稳定, O(n2) 2. 冒牌排序, 稳定 ,O(n2) 设置标记 3. 简单选择排序 ,不稳定 51,52,1->1,52,51 , O(n2) 该方法只是选择排序只有在确定了最小数的前提下才进行交换,大大减少了交换的次数。 4. 插入排序 稳定 O(n2) 折半插入排序,使
        阅读全文
            
摘要:Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't 
        阅读全文
            
 
                    
                 浙公网安备 33010602011771号
浙公网安备 33010602011771号