題目
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
題目
Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.
Question
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.
Question
Given a List of words, return the words that can be typed using letters of alphabet on only one row's of American keyboard like the image below.
題目
Given an array of integers, 1 <= a[i] <= n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twice in this array.
題目
For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular web page's area, your job by now is to design a rectangular web page, whose length L and width W satisfy the following requirements:
題目
Given a non-empty integer array, find the minimum number of moves required to make all array elements equal, where a move is increasing a selected element by 1 or decrementing a selected element by 1.
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the fartheast leaf node.
Calculate the sum of two integers a and b, but you are not allowed to use the operator + and -.
題意
Write an algorithm to determine if a number is "happy".
A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers.