- 博客(38)
- 收藏
- 关注
原创 Leetcode - 429 - N-ary Tree Level Order Traversal
Recursive:Java:private List<List<Integer>> dfs(Node node, List<List<Integer>> res, int level) { if (node == null) return res; if (res.size() == level) res.add(new ArrayList<>()); res.get(level).a..
2021-02-09 11:42:35
186
原创 Leetcode - 589 - N-ary Tree Preorder Traversal
Recursive:Java:class Solution { public List<Integer> list = new ArrayList<>(); public List<Integer> preorder(Node root) { if (root == null) return list; list.add(root.val); for(N..
2021-02-09 11:30:46
233
原创 Leetcode - 590 - N-ary Tree Postorder Traversal (easy)
Recursive:Java:class Solution { List<Integer> list = new ArrayList<>(); public List<Integer> postorder(Node root) { if (root == null) return list; for(Node node: root.children) ..
2021-02-09 11:18:24
177
原创 Leetcode - 144 - Binary Tree Preorder Traversal (medium)
Recursive:Java:public List<Integer> preorderTraversal(TreeNode root) { List<Integer> pre = new LinkedList<Integer>(); preHelper(root,pre); return pre;}public void preHelper(TreeNode root, List<Integer> pre) { if(root==nul
2021-02-09 11:06:38
146
原创 Leetcode - 94 - Binary Tree Inorder Traversal (medium)
Iterativeright child doesn't exist: save all the children on the left chain does exist: save the top of the stack in the resultPython:def inorderTraversal(self, root): res, stack = [], [] while (root or stack...
2021-02-09 10:57:02
143
1
原创 mmdetection 修改config训练自己的detector
简单来说,首页open-mmlab/mmdetection: OpenMMLab Detection Toolbox and Benchmark (github.com)Supported methods模块点连接,如faster rcnn进入后选择模型,config为config 文件所在地址,复制到自己的config路径后修改,如./configs/fire下载model放置./checkpoints找到上级文件,按照格式覆盖上级所含的参数常用的需要改的参数为:num
2021-01-14 10:41:34
974
2
原创 darknet- yolov4 常用命令
AlexeyAB/darknet: YOLOv4v / Scaled-YOLOv4 - Neural Networks for Object Detection (Windows and Linux version of Darknet ) (github.com)To check accuracy mAP@IoU=50:darknet.exe detector map data/obj.data yolo-obj.cfg backup\yolo-obj_7000.weights To che..
2021-01-14 10:10:05
810
原创 mmdetection常用命令
1. Testpython tools/test.py configs/ballon/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_balloon.py work_dirs/mask_rcnn_r50_caffe_fpn_mstrain-poly_1x_balloon.py/latest.pth --eval bbox segm2. Trainpython tools/train.py configs/ballon/mask_rcnn_r50_caffe_f
2021-01-04 13:42:15
2298
1
原创 Leetcode - 49 - Group Anagrams (medium)
Given an array of stringsstrs, groupthe anagramstogether. You can return the answer inany order.AnAnagramis a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once....
2020-12-19 23:28:56
145
2
原创 Leetcode - 242 - Valid Anagram (easy)
Solutions:(1) Arrays.sort(str) directlyJava:public boolean isAnagram(String s, String t) { if (s.length() != t.length()) { return false; } char[] str1 = s.toCharArray(); char[] str2 = t.toCharArray(); Arrays.sort(str1);..
2020-12-19 23:09:48
180
1
原创 Leetcode - 239 - Sliding Window Maximum (hard)
You are given an array of integersnums, there is a sliding window of sizekwhich is moving from the very left of the array to the very right. You can only see theknumbers in the window. Each time the sliding window moves right by one position.Return...
2020-12-19 18:18:36
129
1
原创 Leetcode - 155 - Min Stack (easy)
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack. pop() -- Removes the element on top of the stack. top() -- Get the top element. getMin() -- Retrieve the minimum ele
2020-12-19 16:22:06
189
1
原创 Leetcode - 20 - Valid Parentheses (easy)
Given a stringscontaining just the characters'(',')','{','}','['and']', determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct ...
2020-12-17 19:36:46
208
2
原创 Leetcode - 42 - Trapping Rain Water (hard)
Givennnon-negative integers representing an elevation map where the width of each bar is1, compute how much water it can trap after raining.Solutions:ans = sum {min(left_max,right_max)−height[i]min(left_max,right_max)−height[i] for all element...
2020-12-10 10:15:45
146
原创 Leetcode - 641 - Design Circular Deque (medium)
Solutions:C++:#include <vector>#include <iostream>using namespace std;class MyCircularDeque {private: vector<int> buffer; int cnt; int k; int front; int rear;public: /** Initialize your data structure..
2020-12-10 00:21:16
98
原创 Leetcode - 66 - Plus One (easy)
Given anon-emptyarray of decimal digitsrepresenting a non-negative integer, incrementone to the integer.The digits are stored such that the most significant digit is at the head of the list, and each element in the array contains a single digit.You...
2020-12-09 08:00:45
102
原创 Leetcode - 88 - Merge Sorted Array (easy)
Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:The number of elements initialized innums1andnums2aremandnrespectively. You may assume thatnums1has enough space (size that isequaltom+n) t...
2020-12-08 20:54:26
122
原创 Leetcode - 84 - Largest Rectangle in Histogram (hard)
Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.
2020-12-02 00:41:53
115
2
原创 Leetcode - 21 - Merge Two Sorted Lists (easy)
Merge two sorted linked lists and return it as a newsortedlist. The new list should be made by splicing together the nodes of the first two lists.Solutions:(1) Recursive:The recursive function mergeTwoLists(ListNode l1, ListNode l2) mean merge...
2020-12-01 15:15:08
162
原创 Leetcode - 189 - Rotate Array (medium)
Given an array, rotate the array to the right byksteps, wherekis non-negative.Follow up:Try to come up as many solutions as you can, there are at least 3 different ways to solve this problem. Could you do it in-place with O(1) extra space?So...
2020-12-01 13:39:55
144
原创 Leetcode - 25 - Reverse Nodes in k-Group (hard)
Given a linked list, reverse the nodes of a linked listkat a time and return its modified list.kis a positive integer and is less than or equal to the length of the linked list. If the number of nodes is not a multiple ofkthen left-out nodes, in the...
2020-11-29 00:20:42
292
原创 Leetcode - 26 - Remove Duplicates from Sorted Array
Given a sorted arraynums, remove the duplicatesin-placesuch that each element appears onlyonceand returns the new length.Do not allocate extra space for another array, you must do this bymodifying the input arrayin-placewith O(1) extra memory.C...
2020-11-28 21:12:49
83
原创 Leetcode - 142 - Linked List Cycle II
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following thenextpointer. Internally,posis us...
2020-11-27 14:31:36
121
原创 Leetcode - 141 - Linked List Cycle
Givenhead, the head of a linked list, determine if the linked list has a cycle in it.There is a cycle in a linked list if there is some node in the list that can be reached again by continuously following thenextpointer. Internally,posis used to den...
2020-11-27 13:37:26
149
原创 Leetcode - 24 - Swap Nodes in Pairs
Given alinked list, swap every two adjacent nodes and return its head.You maynotmodify the values in the list's nodes. Only nodes itself may be changed.Solutions:(1) Recursive: when head.next.next pairs are swapped, only need to swap the first t...
2020-11-25 14:10:19
115
1
原创 Leetcode - 206 - Reverse Linked List
Reverse a singly linked list.Example:Follow up:A linked list can be reversed either iteratively or recursively. Could you implement both?Solutions:(1) IterativeWe want the curr->next to be prev and in order to iterate in the loop, three.
2020-11-24 14:01:47
109
原创 Leetcode - 70 - Climbing Stairs
You are climbing a staircase. It takes n steps to reach the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?Solutions:(1) Appliesto a small nTry to compose the big abstract problem by simila..
2020-11-23 23:49:29
153
原创 Leetcode - 11 - Container With Most Water
Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of the line i is at (i, ai) and (i, 0). Find two lines, which, together with the x-axis forms a cont.
2020-11-23 15:06:05
101
原创 Leetcode - 283 - move zeros
Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.Solutions:(1) In the first loop, count the number of zeros. In the second loop, if not zero, move forward; ...
2020-11-21 19:45:28
196
原创 Leetcode - 15 - Three Sum
Given an arraynumsofnintegers, are there elementsa,b,cinnumssuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Notice that the solution set must not contain duplicate triplets.Solutions:(1) O(n^3...
2020-11-21 18:00:02
197
原创 Leetcode - 1 - Two Sum
1. Two SumGiven an array of integersnumsand an integertarget, returnindices of the two numbers such that they add up totarget.You may assume that each input would haveexactlyone solution, and you may not use thesameelement twice.You can retu...
2020-11-21 17:26:42
105
原创 circular queue 多语言多种方法对比 (整理自 leetcode discussion)
解析:每种方法都需要设置代表首、尾的变量,设为front、rear。 在rear位置插入即入队列,front位置删除即出队列。 循环队列找到首尾的算法都是 (rear或front + 1) % length。C++class MyCircularQueue {public: /** Initialize your data structure here. Set th...
2019-01-07 16:28:40
381
转载 人人都能掌握的6个数据分析工具
原文链接:https://www.ctocio.com/ccnews/11262.html 大数据时代人人都拥有数据, 但是提到数据分析,听起来似乎是专家才能做的事情。确实, 如果你想成为数据科学家, 那么好好学习机器学习、Hadoop和R吧。 不过如果你只是想简单地做些分析,那么还是有一些学习曲线不那么陡峭的“傻瓜”工具可用,以下是GigaOM的博客作者Derrick Harris推...
2018-08-07 12:28:25
4561
转载 Devcon2 (第二届全球区块链开发者峰会)演讲PPT下载
感谢ethfans.org的辛苦整理!第一天议程1.开幕致辞:欢迎&介绍演讲嘉宾:Ming Chan, Vitalik Burtin, Dr. Christian Reitwiessner, Alex Van de Sande, Jeff Wilcke, Peter Szilagyi, Martin Becze以太坊执行董事Ming Chan女士协同基金会首席开发人员为第二届以太坊开发者大...
2018-05-16 20:55:59
1108
转载 值得收藏的27个机器学习的小抄
机器学习(Machine Learning)有很多方面,当我开始研究学习它时,我发现了各种各样的“小抄”,它们简明地列出了给定主题的关键知识点。最终,我汇集了超过 20 篇的机器学习相关的小抄,其中一些我经常会翻阅,而另一些我也获益匪浅。这篇文章里面包含了我在网上找到的 27 个小抄,如果你发现我有所遗漏的话,请告诉我。机器学习领域的变化是日新月异的,我想这些可能很快就会过时,但是至少在目前,它们...
2018-05-03 16:29:05
131
转载 AndroidStudio 每次打开文件提示setup jdk
转自:http://blog.youkuaiyun.com/liushuaiq/article/details/52667875(一个困扰了我一段时间,一直没找到答案的问题。。)导入一个新项目,各种编译问题,然后自己不断修修补补,到最后差不多编译一下居然提示setup jdk,然后一片红。解决方法:点击 File->Invalidate Caches/Restart ,然后点击Invalidate an...
2018-04-28 11:32:13
734
转载 安卓命名规则
见https://github.com/ribot/android-guidelines/blob/master/project_and_code_guidelines.md
2018-04-23 19:49:56
198
原创 poj-1003
#include <stdio.h>int main(){ float c; while(scanf("%f",&c) && c){ int a=1,num=0; float sum=0, b=0.5; do{ sum = sum+b; num...
2018-03-06 18:45:29
139
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人