随笔分类 -  leetcode

摘要:https://leetcode-cn.com/problems/find-the-town-judge/ 我只会写一些垃圾代码: class Solution { public int findJudge(int n, int[][] trust) { class NodeMap { int re 阅读全文
posted @ 2022-04-05 15:58 v大喵 阅读(24) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/first-unique-character-in-a-string/ 一直都写着没有灵魂的代码 class Solution { public int firstUniqChar(String s) { if(s.length() 阅读全文
posted @ 2022-04-04 19:23 v大喵 阅读(24) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/design-hashset/ 我会写一些无脑得代码 class MyHashMap { class Node { int key; int value; Node(int key, int value) { this.key = k 阅读全文
posted @ 2022-04-04 16:59 v大喵 阅读(17) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/design-hashset/ 无脑操作: class MyHashSet { private List<Integer> a = new ArrayList<>(); public MyHashSet() { } public vo 阅读全文
posted @ 2022-04-04 15:42 v大喵 阅读(20) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/design-circular-queue/ 请原谅我直接,这一题。。。我这么傻心里都嘀咕,怎么出得那么傻~没有灵魂得题目。 class MyCircularQueue { List<Integer> queue = new Arra 阅读全文
posted @ 2022-04-04 02:35 v大喵 阅读(20) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/add-binary/ 抄来的,别人家的解决方案: class Solution { public String addBinary(String a, String b) { if(a == null || a.length() = 阅读全文
posted @ 2022-04-04 01:51 v大喵 阅读(23) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/pascals-triangle/ 对,没有灵魂的代码: class Solution { public List<List<Integer>> generate(int numRows) { List<List<Integer>> 阅读全文
posted @ 2022-04-04 01:48 v大喵 阅读(26) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/find-pivot-index/submissions/ 没有灵魂的低端程序狗: class Solution { public int pivotIndex(int[] nums) { if(nums.length == 1) { 阅读全文
posted @ 2022-04-04 01:23 v大喵 阅读(16) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/implement-strstr/ 能不动脑子为什么要折腾呢? class Solution { public int strStr(String haystack, String needle) { if(needle.length 阅读全文
posted @ 2022-04-03 15:27 v大喵 阅读(11) 评论(0) 推荐(0) 编辑
摘要:https://leetcode-cn.com/problems/longest-common-prefix/ 请原谅我就是个只会暴力计算的低端程序狗: class Solution { public static List<String> getPrefixtring(String str) { 阅读全文
posted @ 2022-04-03 15:13 v大喵 阅读(27) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示