Leetcode
Holmes96
这个作者很懒,什么都没留下…
展开
-
LeetCode-276. 栅栏涂色
有 k 种颜色的涂料和一个包含 n 个栅栏柱的栅栏,每个栅栏柱可以用其中一种颜色进行上色。你需要给所有栅栏柱上色,并且保证其中相邻的栅栏柱 最多连续两个 颜色相同。然后,返回所有有效涂色的方案数。注意:n 和 k 均为非负的整数。示例:输入: n = 3,k = 2输出: 6解析: 用 c1 表示颜色 1,c2 表示颜色 2,所有可能的涂色方案有: ...原创 2020-02-01 22:30:54 · 618 阅读 · 0 评论 -
Leetcode 277——Find the Celebrity
Problem DescriptionSuppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is that all the other n - 1 people k...转载 2019-05-05 13:10:16 · 183 阅读 · 0 评论 -
Leetcode 206 Reverse Linked List
Reverse a singly linked list.Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULL# Definition for singly-linked list.# class ListNode:# def __init...原创 2019-09-17 21:50:30 · 79 阅读 · 0 评论