1个offer就够了
1个offer就够了
全部文章
算法
笔试记录(5)
归档
标签
去牛客网
登录
/
注册
1个offer就够了的博客
全部文章
/ 算法
(共13篇)
字符串
最长回文串:https://leetcode-cn.com/problems/longest-palindrome/ class Solution { public int longestPalindrome(String s) { //先用HashMap统计字符的出现次数 M...
2020-09-04
0
510
栈与队列
队列实现栈:https://leetcode-cn.com/problems/implement-stack-using-queues/ class MyStack { Queue<Integer> queue = new LinkedList<>(); public...
2020-09-04
0
509
位运算
汉明距离(与运算):https://leetcode-cn.com/problems/hamming-distance/ 只出现1次的数(异或抵消):https://leetcode-cn.com/problems/single-number/submissions/ class Solution...
2020-09-04
0
451
贪心
跳跃游戏:https://leetcode-cn.com/problems/jump-game/class Solution { public boolean canJump(int[] nums) { //提取第一个元素作为第一次的跳跃 int jump = nums[0];...
2020-09-04
0
532
数组
旋转图像:https://leetcode-cn.com/problems/rotate-image/submissions/class Solution { public void rotate(int[][] matrix) { if(matrix.length == 0 || ma...
2020-09-04
0
457
数学
判断素数 import java.util.Scanner; public class LC { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long num = s...
2020-09-04
0
560
二叉树
0. 总结 层序遍历,从左到右。LinkedList,addLast,PollFirst。先左后右 前序遍历,Stack,push,pop,add。先右后左 中序遍历:Stack,先存入左子树,然后出栈,指向右子树 后序遍历:Stack,push,pop,addFirst。先左后右 BST中序为递...
2020-09-04
0
498
链表
1. 删除节点: 删除链表的倒数第N个节点:https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/ class Solution { public ListNode removeNthFromEnd(ListNode ...
2020-09-04
0
533
哈希表
两数之和:https://leetcode-cn.com/problems/two-sum/ class Solution { public int[] twoSum(int[] nums, int target) { Map<Integer,Integer> map = n...
2020-09-04
0
438
二分查找
开平方:https://leetcode-cn.com/problems/sqrtx/submissions/ class Solution { public int mySqrt(int x) { //双指针 int left = 1; int right = x...
2020-09-04
0
457
首页
上一页
1
2
下一页
末页