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