Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

An input string is valid if:

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

Write a function to find the longest common prefix string amonst an array of strings.

If there is no common prefix, return an empty string "".

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

題目

  Given an integer n, return the number of trailing zeroes in n!.

Davis 發表在 痞客邦 留言(0) 人氣()

Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot makes a circle, which means it moves back to the original place.

The move sequence is represented by a string. And each move is represent by a character. The valid robot moves are  R  (Right).  L (Left), U (Up) and D (down). The output should be true or false representing whether the robot makes a circle.

Davis 發表在 痞客邦 留言(0) 人氣()

題目

    Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

題目

Given an integer array, find three numbers whose product is maximum and output the maximum product.

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

題目

Given an array of intergers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct.

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

題目

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.

Davis 發表在 痞客邦 留言(0) 人氣()

題目

You are given a string representing an attendance record for a student. The record only contains the following three characters:

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

題目

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.

文章標籤

Davis 發表在 痞客邦 留言(0) 人氣()

1 2345