# learn-leetcode **Repository Path**: hanchers/learn-leetcode ## Basic Information - **Project Name**: learn-leetcode - **Description**: leetcode 实战 - **Primary Language**: Java - **License**: MulanPSL-1.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-01-15 - **Last Updated**: 2022-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # leetcode practise and study ## purpose - for brain - for job - for learn - for communicate ## 工具库(tools) ### hash 累计法 ### 位运算 ### 排序 ### 摩尔投票求众数 规则: 1. 如果计数器为0,则选举为候选人and 计数+1 2. 如果计数不为0,匹配+1,不匹配-1 3. 如果候选人多于1个,还需要再遍历一遍,确认候选人票数 实现: 1. 初始化候选人 2. 投+1票 3. 判断计数是否为0,是否要更换候选人 4. 最后投-1票 see: [摩尔算法详解](https://blog.csdn.net/happyeveryday62/article/details/104136295), [摩尔算法动态展示](https://www.cs.utexas.edu/~moore/best-ideas/mjrty/index.html) [labuladong 大神](https://labuladong.gitee.io/algo/4/29/107/) [更有效的刷题](https://labuladong.gitee.io/algo/4/29/107/)