logo
publist
写文章

简介

该用户还未填写简介

擅长的技术栈

可提供的服务

暂无可提供的服务

leetcode 2. Add Two Numbers(链表两数相加)

Example 3:Input: l1 = [9,9,9,9,9,9,9], l2 = [9,9,9,9]Output: [8,9,9,9,0,0,0,1]Constraints:The number of nodes in each linked list is in the range [1, 100].0 <= Node.val <= 9It is guaranteed that

#链表#leetcode#算法
leetcode 473. Matchsticks to Square(火柴棍组正方形)

摆火柴棍的问题,要用到所有的火柴棍,摆成一个正方形,也就是4条边长要相等。可用多个火柴棍拼成一条边。思路:DFS因为要用到所有的火柴棍,而且正方形的4条边长是相等的,边长总长度为所有火柴棍之和,那么如果边长和不是4的倍数,直接返回false,下面要按照每条边长为(边长和/4)来DFS先把火柴棍长度排序,然后从大到小搜索,边长初始长度为0,加上火柴棍长度 > target(每条边长)时,跳过,相同的

#leetcode#算法
leetcode 509. Fibonacci Number(斐波那契数字)

The Fibonacci numbers, commonly denoted F(n) form a sequence, called the Fibonacci sequence, such that each number is the sum of the two preceding ones, starting from 0 and 1. That is,F(0) = 0, F(1) =

#leetcode#算法
g2o库的一些坑(undefined reference to, fatal error: cs.h)

g2o库是一个图优化库,在slam中多有应用。下面是踩过的一些坑,供小伙伴们参考第一坑/usr/local/include/g2o/solvers/csparse/csparse_extension.h:27:10: fatal error: cs.h: 没有那个文件或目录27 | #include <cs.h>|^~~~~~是这样解决的首先再次安装了一次csparse库,已经安装过的

#计算机视觉
leetcode 310. Minimum Height Trees(最小高度树)

A tree is an undirected graph in which any two vertices are connected by exactly one path. In other words, any connected graph without simple cycles is a tree.Given a tree of n nodes labelled from 0 t

#leetcode#算法
leetcode 148. Sort List(链表排序)

链表排序。思路:链表没有下标,如果是两个已经排好序的链表组合到一起,那就简单了,直接merge sort,那能不能分而治之,把一个链表不断地拆成两个,直到拆到为空或者只有一个元素,这样必然是排好序的,然后再逐渐merge,拼成整个链表。拆成两部分用快慢指针就可以,但是注意,一定要把慢指针(也就是中间点)的前面指针断开,这样才达到拆分的目的。public ListNode sortList(List

#链表#leetcode
leetcode 630. Course Schedule III(课程表III)

There are n different online courses numbered from 1 to n. Each course has some duration(course length) t and closed on dth day. A course should be taken continuously for t days and must be finished b

#算法
    共 45 条
  • 1
  • 2
  • 3
  • 4
  • 5
  • 请选择