Given an integer
n, return true if it is a power of three. Otherwise, return false.
n is a power of three, if there exists an integer
x such that $n == 3^x$.
You are given an integer array
heights representing the heights of buildings, some
bricks, and some
You start your journey from building
0 and move to the next building by possibly using bricks or ladders.
While moving from building
i to building
(h [i+1] - h [i])bricks.
Return the furthest building index (0-indexed) you can reach if you use the given ladders and bricks optimally.
You are given an n x n 2D
matrix representing an image, rotate the image by 90 degrees (clockwise).
You have to rotate the image in-place, which means you have to modify the input 2D matrix directly. DO NOT allocate another 2D matrix and do the rotation.
n servers numbered from
n-1 connected by undirected server-to-server
connections forming a network where
connections [i] = [a, b] represents a connection between servers
b. Any server can reach any other server directly or indirectly through the network.
A critical connection is a connection that, if removed, will make some server unable to reach some other server.
Return all critical connections in the network in any order.
There is a rectangular brick wall in front of you with
n rows of bricks. The
ith row has some number of bricks each of the same height (i.e., one unit) but they can be of different widths. The total width of each row is the same.
Draw a vertical line from the top to the bottom and cross the least bricks. If your line goes through the edge of a brick, then the brick is not considered as crossed. You cannot draw a line just along one of the two vertical edges of the wall, in which case the line will obviously cross no bricks.
Given the 2D array
wall that contains the information about the wall, return the minimum number of crossed bricks after drawing such a vertical line.