
LeetCode
高能粒子
这个作者很懒,什么都没留下…
展开
-
LeetCode 540 Single Element in a Sorted Array 在分类好的数组里寻找单个元素 C语言 异或的巧妙使用
540. Single Element in a Sorted Array原题C语言题解原题You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once. Find this single element that appears only once.Example原创 2020-05-14 02:22:26 · 197 阅读 · 0 评论 -
LeetCode 733 Flood Fill 洪水填充 C语言 DFS 深度优先搜索算法
733. Flood Fill题目解题思路代码C语言C++JAVA题目An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535).Given a coordinate (sr, sc) representing the starting pixel (row and column) of the flood fil原创 2020-05-12 03:20:45 · 924 阅读 · 0 评论 -
LeetCode 997 Find the Town Judge 寻找小镇法官 C语言
Find the Town JudgeIn a town, there are N people labelled from 1 to N. There is a rumor that one of these people is secretly the town judge.If the town judge exists, then:The town judge trusts nobody.Everybody (except for the town judge) trusts the .原创 2020-05-10 23:16:06 · 448 阅读 · 1 评论 -
LeetCode 367 Valid Perfect Square 有效的完全平方 C语言
Valid Perfect SquareGiven a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in library function such as sqrt.实现函数功能:检测输入的正整数是否能被完全开方,若能被完全开方则函数输出值为true,若不能则输出false。注意,不能使用sqrt.原创 2020-05-10 03:00:40 · 293 阅读 · 0 评论 -
LeetCode 1232 Check If It Is a Straight Line 检测是否为直线 C语言
Check If It Is a Straight LineYou are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane.Example 1:Input: coordinates = [[1,2],[2,3],[3,4].原创 2020-05-09 01:12:31 · 384 阅读 · 0 评论 -
LeetCode 993 Cousins in Binary Tree 判断二叉树堂兄弟节点 C语言
Cousins in Binary TreeIn a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1.Two nodes of a binary tree are cousins if they have the same depth, but have...原创 2020-05-08 07:03:56 · 268 阅读 · 0 评论 -
LeetCode 169 Majority Element 多数的元素 C语言
Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element alway...原创 2020-05-06 18:26:29 · 189 阅读 · 0 评论 -
LeetCode 387 First Unique Character in a String 字符串中的第一个唯一的字母 C语言
387. First Unique Character in a StringGiven a string, find the first non-repeating character in it and return it’s index. If it doesn’t exist, return -1..从给定的字符串中找到第一个不重复的字母,并输出其在字符串中的指针位置(第一个字母的位...原创 2020-05-06 03:16:18 · 146 阅读 · 0 评论 -
LeetCode 476 Number Complement 补码 C语言
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.输入一个正整数,求其转为二进制之后的每位都取反的值(十进制)。没有符号位。例如:输入的正整数为5,其二进制为101,取反为010,010转...原创 2020-05-04 19:16:13 · 170 阅读 · 0 评论 -
LeetCode 383 Ransom Note 勒索信 C语言
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines ; ot...原创 2020-05-03 22:50:43 · 257 阅读 · 0 评论 -
LeetCode 278 First Bad Version 第一个坏的版本 C语言
First Bad VersionYou are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is de...原创 2020-05-03 01:18:39 · 155 阅读 · 0 评论 -
LeetCode 771 Jewels and Stones 宝石和石头 C语言
Jewels and StonesYou’re given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have. You want to know...原创 2020-05-03 01:10:31 · 304 阅读 · 0 评论 -
LeetCode 1 Two Sum 两数之和 C语言
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same e...原创 2020-05-01 01:24:42 · 199 阅读 · 0 评论