## Solution to Lowest Common Ancestor from Jobdu

14 Sep

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1509 Question Name: Lowest Common Ancestor Question Description: Find the lowest common ancestor of two nodes in a binary tree. Input: the input might contain multiple test cases. Globally the first line includes one interger N (0 … Read More »

## Solution to String To Int from Jobdu

13 Sep

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1508 Question Name: String To Int Question Description: Convert the input string into an integer. The input string may or may not represent a valid and non-overflow integer. Input: the input might contain multiple test cases. Each … Read More »

## Solution to Add Two Numbers from Jobdu

13 Sep

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1507 Question Name: Add Two Numbers Question Description: Compute the sum of two integers without addition, subtraction, multiplication and division. Input: the input might contain multiple test cases. Each line, as a test case, contains two integers … Read More »

## Solution to Accumulate from Jobdu

12 Sep

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1506 Question Name: Accumulate Question Description: Compute the sum of integers from 1 to n without condition statement like “if”, “while”, “for”, “else”, “switch”, “case” and “? :”. And no multiplication or division is allowed. Input: the … Read More »

## Solution to Last Number In Circle from Jobdu

11 Sep

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1356 Question Name: Last Number In Circle Question Description: N persons are standing in a circle. We are removing the one from the circle every M persons, until only one person is in its original position. Find … Read More »

## Solution to Continuous Cards from Jobdu

11 Sep

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1355 Question Name: Continuous Cards Question Description: For a set of cards, Ace is treated as 1. J is 11, Q 12, and K 13. Jokers, up to four jokers, is represented as 0, and could be … Read More »

## Solution to Dices Probability from Jobdu

11 Sep

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1360 Question Name: Dices Probability Question Description: You have some customized dices. Find the three most possible sum of the dices, if you roll them. Input: the input might contain multiple test cases. Each line, as a … Read More »

## Solution to Left Rotate String from Jobdu

10 Sep

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1362 Question Name: Left Rotate String Question Description: given a string, rotate it leftward by some length. Input: the input might contain multiple test cases. Each line, as a test case, contains a string and a non-negative … Read More »

## Solution to Reverse Words In Sentence from Jobdu

9 Sep

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1361 Question Name: Reverse Words In Sentence Question Description: given a string, reverse the words’ order. Input: the input might contain multiple test cases. Each line, as a whole string, is a test case. Output: print the … Read More »

## Solution to Continue Sequence With Sum from Jobdu

9 Sep

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1354 Question Name: Continue Sequence With Sum Question Description: given a target integer, show all the positive integer arithmetic sequence, whose sum is equal to the target. Input: the input might contain multiple test cases. Each line … Read More »