注释 testcases

(1)简单一想O(n)算法,有可能通过二分查找变形优化成log(n)

(2)双指针:一快一慢 一静一动(数组中最小的长度满足条件,常常用于,确定了一个范围,然后一个指针静止,一个指针收缩) 一前一后

(3)二分查找可以一次性做完,也可以分两次来做,一次用于二分查找左边确定左边界,一次用于二分查找确定右边界。

(4)数字理解成二进制的方法,就是通过一个bitvector,简而言之一个32位的数组,循环每一位进行处理。

(5)Maximum Subarray 问题,用localMax 记录每一次局部最大值,全局的最大值是局部最大值的最大值。

(6)找一个数字[1,n]中满足某个条件的数字,也可以把数字看成一个数组,通过采用二分查找的方式解决。

(7)一个hashmap 不够就用两个,一个用于记录原始的key,value值,一个用于扫描式和原始的hashmap进行比对。

(8)对于数学规律题,一定要多写几个case观察规律,尤其是数组中的规律问题。

(9)在代码写完之时,一定一定一定不能急,要写好test case

(10)多用hashset hashmap 利用空间复杂度先解决问题为上策

(11)一旦涉及到两个数的关系( ret = (((dividend ^ divisor) >> 31) & 1) == 1 ? -ret: ret;),就要考虑到两个数是正负号问题,是否会溢出问题。

(12)stack的应用不一定要存value 也可以存index,存index的好处是 一方面可以通过index获取到value 另外一方面可以通过Index解决 最长  最短问题。

leetcode再次总结的更多相关文章

  1. [LeetCode] Longest Substring with At Least K Repeating Characters 至少有K个重复字符的最长子字符串

    Find the length of the longest substring T of a given string (consists of lowercase letters only) su ...

  2. Leetcode 笔记 98 - Validate Binary Search Tree

    题目链接:Validate Binary Search Tree | LeetCode OJ Given a binary tree, determine if it is a valid binar ...

  3. Leetcode 笔记 36 - Sudoku Solver

    题目链接:Sudoku Solver | LeetCode OJ Write a program to solve a Sudoku puzzle by filling the empty cells ...

  4. [LeetCode] Matchsticks to Square 火柴棍组成正方形

    Remember the story of Little Match Girl? By now, you know exactly what matchsticks the little match ...

  5. [LeetCode] Split Array Largest Sum 分割数组的最大值

    Given an array which consists of non-negative integers and an integer m, you can split the array int ...

  6. [LeetCode] Coin Change 硬币找零

    You are given coins of different denominations and a total amount of money amount. Write a function ...

  7. [LeetCode] Additive Number 加法数

    Additive number is a positive integer whose digits can form additive sequence. A valid additive sequ ...

  8. [LeetCode] Word Pattern II 词语模式之二

    Given a pattern and a string str, find if str follows the same pattern. Here follow means a full mat ...

  9. [LeetCode] Single Number III 单独的数字之三

    Given an array of numbers nums, in which exactly two elements appear only once and all the other ele ...

随机推荐

  1. 【5min+】 这些C#的运算符您都认识吗?

    系列介绍 [五分钟的dotnet]是一个利用您的碎片化时间来学习和丰富.net知识的博文系列.它所包含了.net体系中可能会涉及到的方方面面,比如C#的小细节,AspnetCore,微服务中的.net ...

  2. PostMan向企业微信机器人传送数据测试

    1 在企业微信中创建机器人  获取:webhook 地址 2.在Postman软件中创建Post文件 Post文件请求类型要与机器人所接受的类型一致.Get  或者 Post Url地址为上面webh ...

  3. Asp.net core下利用EF core实现从数据实现多租户(1)

    前言 随着互联网的的高速发展,大多数的公司由于一开始使用的传统的硬件/软件架构,导致在业务不断发展的同时,系统也逐渐地逼近传统结构的极限. 于是,系统也急需进行结构上的升级换代. 在服务端,系统的I/ ...

  4. Codeforces_496_E_贪心

    http://codeforces.com/problemset/problem/496/E 这好像叫序列混合贪心,简单地讲,用歌去匹配最符合条件的人.用了multiset,重载了<,加快寻找最 ...

  5. Ops:jar包启动关闭脚本

    简介 公司开发架构为java语言的rpc dubbo架构,将功能分解为各个模块,模块较多,发布到环境上的应用为编译后的jar包和配置文件,以及启动关闭jar包的shell脚本.之前经常会出现进程启动不 ...

  6. Go语言实现:【剑指offer】第一个只出现一次的字符位置

    该题目来源于牛客网<剑指offer>专题. 在一个字符串(0<=字符串长度<=10000,全部由字母组成)中找到第一个只出现一次的字符,并返回它的位置, 如果没有则返回 -1( ...

  7. Codeforces Round #617 (Div. 3) D. Fight with Monsters

    D : Fight with Monsters 题目大意 : 有一组数,每个值对应着一个怪物的 hp 值,现在有两个人,一个自己一个对手,每个人有一个攻击值, 两个人轮流攻击怪物,如果是自己将怪物先打 ...

  8. javascript canvas全部API

    HTMLCanvasElement//canvas elem对象 属性 height//高 width//宽 方法 getContext()//获取<canvas>相关的可绘制的上下文 t ...

  9. Python Flask 开发学习笔记

    Flask学习 安装pipenv虚拟环境 pip Install pipenv 运行pipenv pipenv --version 进入虚拟容器 pipenv install 安装flask pipe ...

  10. Nginx是什么 ? 能干嘛 ?

    学习博客:https://blog.csdn.net/forezp/article/details/87887507 学习博客:https://blog.csdn.net/qq_29677867/ar ...