原创 【Leetcode Algorithm】Roman to Integer
Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 羅馬數字與阿拉
原创 【Leetcode Algorithm】Power of Two
Given an integer, write a function to determine if it is a power of two. 第一次嘗試代碼: public class Solution { public bo
原创 【Leetcode Algorithm】Add Binary
Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". 自己的代
原创 【Leetcode Algorithm】Count and Say
The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1 is read of
原创 【Leetcode Algorithm】Rectangle Area
Find the total area covered by two rectilinear rectangles in a 2D plane. Each rectangle is defined by its bottom lef
原创 【Leetcode Algorithm】Min Stack
Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push elem
原创 【2016去哪兒網筆試題】找出輸入中有幾個死鎖
(題目大致意思) 尋找輸入中有幾個死鎖,首先輸入總共有多少條數據。然後一行輸入的信息中第一列代表數據id,第二列代表正在佔用的資源id(如果有多個,則用逗號分割,沒有則爲空格),第三列代表申請佔用的資源id(如果有多個,則用逗號分割,沒有
原创 【Leetcode Algorithm】Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7],
原创 ACM 2001 計算兩點間的距離
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Description 輸入
原创 【hihoCoder】#1086: Browser Caching (微軟筆試題)
#1086 : Browser Caching 時間限制:10000ms 單點時限:1000ms 內存限制:256MB 描述 When you browse the Internet, browser usually cach
原创 【Leetcode Algorithm】String to Integer (atoi)
Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a c
原创 【Leetcode Algorithm】ZigZag Conversion
The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to dis
原创 【Leetcode Algorithm】Contains Duplicate II
Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the arr
原创 【Leetcode Algorithm】Longest Common Prefix
Write a function to find the longest common prefix string amongst an array of strings. 自己的代碼: 1 2 3 4 5 6 7
原创 【Leetcode Algorithm】Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space. 代碼: 1 2 3 4 5 6 7 8 9 10 11 12