- 博客(30)
- 收藏
- 关注
原创 java后端 春招各公司面试记录(内含字节、阿里等大厂)
java后端 春招各公司面试记录(内含字节、阿里等大厂)嘀嗒面试Meta APP北大软件望石智慧望石二面望石三面四面顺丰科技顺丰二面顺丰三面火线安全笔试火线安全面试根网笔试Keep一面Keep二面阿里妈妈 淘宝联盟一面天天乐学天天乐学二面火币网火币网二面字节有可能考的美团一面阿里一面滴滴一面字节阿里一面字节教育一面字节教育二面字节若干面百度答主本科生,收到若干大厂、小厂offer,建议基础一般的同学们可以按照先小厂再大厂的顺序面试,在春招末尾抄底大厂。嘀嗒面试单例模式 各种设计模式各种排序算法H
2021-07-09 18:16:33
953
原创 验证回文串
验证回文串leetcode 125class Solution { public boolean isPalindrome(String s) { int left = 0,right = s.length()-1; while(left<right){ while(left<right && !Character.isLetterOrDigit(s.charAt(left))) left++;
2021-04-17 00:24:22
168
原创 反转链表
leetcode 206 //迭代 public ListNode reverseList(ListNode head) { if(head == null || head.next == null) return head; ListNode pre = head,cur = head.next,nex; pre.next = null; while(cur!=null){ nex = cur.next
2021-03-20 02:27:30
128
原创 相交链表
leetcode 160//法1:哈希表//法2:双指针 public ListNode getIntersectionNode(ListNode headA, ListNode headB) { if(headA == null || headB == null) return null; ListNode p = headA,q = headB; int count = 0; while(p!=q){ p
2021-03-20 01:53:37
90
原创 排序链表
leetcode 148 //此法适用于不能有重复元素的链表,重点看treemap遍历方法 public ListNode sortList(ListNode head) { TreeMap<Integer,ListNode> map = new TreeMap<>(); ListNode h = head; while(h!=null){ map.put(h.val,h);
2021-03-20 01:25:58
79
原创 环形链表
leetcode 141 //hashset public boolean hasCycle(ListNode head) { HashSet<ListNode> set = new HashSet<>(); while(head!=null){ if(set.contains(head)) return true; set.add(head); head.
2021-03-17 17:03:34
92
原创 最小栈
leetcode 155java实现栈: stack类底层是数组,而用linkedlist继承deque底层是链表 //用栈实现 // 数据栈 private Stack<Integer> data; // 辅助栈 private Stack<Integer> helper; /** * initialize your data structure here. */ public MinStack() {
2021-03-17 12:57:23
106
原创 复制带随机指针的链表
leetcode 138 //hashmap回溯 HashMap <Node,Node> map = new HashMap<>(); public Node copyRandomList(Node head) { if(head==null) return null; if(map.containsKey(head)) return map.get(head); Node node = new Node(he
2021-03-17 12:10:43
71
原创 两链表中数字相加
两数相加。给你两个 非空 的链表,表示两个非负的整数。它们每位数字都是按照 逆序 的方式存储的,并且每个节点只能存储 一位 数字。答案class Solution { public ListNode addTwoNumbers(ListNode l1, ListNode l2) { ListNode pre = new ListNode(); ListNode cur = pre; int carry = 0; while(l1!=nu
2021-03-16 15:18:05
147
原创 回文串
214三种方法没看懂class Solution { public String shortestPalindrome(String s) { int i = 0; for(int j = s.length() - 1; j >= 0; j--){ if(s.charAt(j) == s.charAt(i)){ i++; } } if(i ==
2021-03-16 09:20:04
82
原创 除自身以外数组的乘积
除自身以外数组的乘积leetcode 238 //左右列表 public int[] productExceptSelf(int[] nums) { int[] res = new int[nums.length]; int[] left = new int[nums.length]; int[] right = new int[nums.length]; left[0]=1;right[nums.length-1]=1;
2021-03-15 14:22:44
70
原创 搜索二维矩阵
leetcode 240 public boolean searchMatrix(int[][] matrix, int target) { int m=matrix.length-1;//行 int n=matrix[0].length-1;//列 int i=0,j=n; while(i<=m&&j>=0){ if(target<matrix[i][j]) j--;
2021-03-14 13:39:19
67
原创 递增三元子序列
递增三元子序列leetcode 334思路牛逼 public boolean increasingTriplet(int[] nums) { int i=Integer.MAX_VALUE,j=Integer.MAX_VALUE; for(int num:nums){ if(i>=num) i=num; else if(j>=num) j=num; else return true
2021-03-14 12:14:24
96
原创 两个数组的交集
两个数组的交集leetcode 350 //哈希表 public int[] intersect(int[] nums1, int[] nums2) { if(nums1.length>nums2.length) return intersect(nums2,nums1); List<Integer> res = new ArrayList<>(); Map<Integer,Integer> map
2021-03-14 10:22:06
106
原创 打乱数组
打乱数组leetcode 384//暴力方法class Solution { private int[] array; private int[] num; private Random rand = new Random(); private List<Integer> getArrayCopy(){ List<Integer> asList = new ArrayList<>(); for(int
2021-03-13 22:57:45
121
原创 移动零
移动零leetcode 283 public void moveZeroes(int[] nums) { //双指针法,有一个指针a指向待更改元素,有一个指针b指向遍历到的元素 int a=0,b=0; while(b<nums.length){ if(nums[b]!=0) nums[a++]=nums[b]; b++; } for(int i=a;i<nu
2021-03-13 19:29:08
86
原创 存在重复元素
存在重复元素 //排序 public boolean containsDuplicate(int[] nums) { Arrays.sort(nums); for(int i=1;i<nums.length;i++){ if(nums[i]==nums[i-1]) return true; } return false; } //hashset public boolean
2021-03-13 18:01:12
93
原创 找众数
找众数找出现次数大于n/2的数找出现此数大于n/3的数找出现次数大于n/2的数leetcode 169 //排序 public int majorityElement(int[] nums) { Arrays.sort(nums); return nums[nums.length/2];//java 默认向下取整,即5/2=2 } //摩尔投票法:当一个数投票数相等时+1,不等时-1,要注意判断当-1后,票数是否为0,若为0则先把当前这个数存为待
2021-03-13 17:43:12
176
原创 乘积最大子数组
乘积最大子数组转自leetcode152运用动态规划 public int maxProduct(int[] nums) { int maxF=nums[0],minF=nums[0],ans=nums[0]; for(int i=1;i<nums.length;i++){ int maf=maxF,mif=minF; maxF=Math.max(maxF*nums[i],Math.max(mif*nums[i
2021-03-13 16:24:06
80
原创 旋转数组
旋转数组给定一个数组,将数组中的元素向右移动 k 个位置转自leetcode 189 //使用额外空间 public void rotate(int[] nums, int k) { int[] newInt = new int[nums.length]; for(int i=0;i<nums.length;i++){ newInt[(i+k)%nums.length] = nums[i]; }
2021-03-13 16:11:20
125
原创 链表反转相关问题
链表反转:转自这里 //递归法 public Node reverse(Node head){ if(head==null || head.next==null) return head; Node temp=head.next; Node newHead=reverse(head.next); temp.next=head; head.next=null; return newHead;
2021-03-13 01:01:50
66
原创 MetaAPP部分笔试题
/* qn2: 下面的代码在java(jdk8)最终会产生几个String对象: String a = "没人"; String b = "比我"; String c = "更懂"; String d = "java"; String s = a + b + c + d; A. 8 B. 6 C. 7 D. 5 */ ...
2021-02-28 00:58:13
9264
11
原创 今日面试
今日面试单例模式HashMap底层原理SQLRedis单例模式单例模式链接设计模式常见面试题目的:确保一个类只能有一个实例,并提供访问它的全局访问点。为解决:一个全局使用的类频繁地创建和销毁。何时使用:当你想控制实例数目,节省系统资源的时候。应用实例:windows是多进程多线程的,在操作一个文件时,不可避免的出现多个进程或线程来同时操作一个文件,因此所有文件处理都必须通过唯一的实例。一些设备管理器比如打印机,需要用到单例模式。假如一个电脑连两个打印机,就不能同时打印一个
2021-02-20 21:45:28
125
原创 位运算和运算优先级
位运算>>>代表无符号右移,>>是有符号右移负数的右移:补码左边补1,之后取原码;负数的左移:补码右边补0,之后取原码。补码是反码+1,如果是负数,则第一位为1不变。例子: 正数:r = 20 << 2 20的二进制补码:0001 0100 向左移动两位后:0101 0000 结果:r = 80 负数:r = -20 << 2 -20 的二进制原码 :1001 0100 -20 的二进制反码 :1110 101
2021-02-18 11:52:56
2163
原创 idea插件安装后不显示问题
安装statistic时发现安装后任务栏没有相应图标。这种情况有可能是插件版本与idea本身版本不同导致的不兼容。解决办法:在https://plugins.jetbrains.com官网下载相应版本的插件,再在原来位置导入就好了。结论:安装插件时要注意安装版本要与idea版本一致。...
2020-04-27 11:37:45
8220
4
原创 springboot项目启动----解决8080端口被占用问题
netstat -nao|findstr 8080taskkill /f /t /im 18784注:18784为8080端口的pid
2020-03-26 11:23:12
682
原创 关于重启oracle无法连接的问题
对于我来说,之前把服务中OracleServiceORCL和TNSListener全部设为手动了,因此每次重启应记得手动打开。或将其改为自动。
2020-03-19 10:06:13
516
原创 关于sql developer无法连接的问题
两种方式:sid/服务名检查环境变量:TNS文件的路径是否正确,该路径下是否有tnsnames.ora和listener.ora如果没有,通过菜单栏Net Configuration Assistant生成检查上述两种文件内容,文件内容:tnsnames.ora# tnsnames.ora Network Configuration File: E:\app\LENOVO\pr...
2020-03-15 18:25:20
1394
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人