题目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
...
题目In 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,
...
题目Given 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 funct
...
题目You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straigh
...
题目In 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 ha
...
题目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 t
...
题目Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.
Example 1:
123Inpu
...
题目Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ra
...
题目You’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 s
...