## Solution to Stack Push Pop Order from Jobdu

10 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1366 Question Name: Stack Push Pop Order Question Description: give two integer arrays. The first one is the order to push the integers into stack. To check whether the second one is an valid order to pop … Read More »

## Solution to Min In Stack from Jobdu

10 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1522 Question Name: Min In Stack Question Description: implement a customized stack. It should provide a function min() to return the minimum value in the stack in O(1) time. Input: the input might contain multiple test cases. … Read More »

## Solution to Print Matrix from Jobdu

10 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1391 Question Name: Print Matrix Question Description: Give an integer matrix, print it in spiral form. Input: the input might contain multiple test cases. Inside each test case, the first line includes two intergers N and M … Read More »

## Solution to Mirror Of Binary Tree from Jobdu

10 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1521 Question Name: Mirror Of Binary Tree Question Description: Give a binary tree, find its mirror copy and print it out in pre-order. Input: the input might contain multiple test cases. Inside each test case, the first … Read More »

## Solution to Substructure In Tree from Jobdu

9 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1520 Question Name: Substructure In Tree Question Description: Give two binary tree, check whether the latter one is a substructure of the first one. Input: the input might contain multiple test cases. Inside each test case, the … Read More »

## Solution to Merge Sorted List from Jobdu

8 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1519 Question Name: Merge Sorted List Question Description: Give two sorted single-linked lists, merge them. Input: the input might contain multiple test cases. Inside each test case, the first line includes two interger N and M (0 … Read More »

## Solution to Reverse List from Jobdu

7 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1518 Question Name: Reverse List Question Description: Give an single-linked list, reverse it in place. Input: the input might contain multiple test cases. Inside each test case, the first line is one interger N (0 <= N … Read More »

## Solution to Kth Node from End from Jobdu

7 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1517 Question Name: Kth Node from End Question Description: Give an single-linked list, find the Kth last node from the end. If there are less than K nodes in the list, you should return null. Input: the … Read More »

## Solution to Reorder Array from Jobdu

7 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1516 Question Name: Reorder Array Question Description: Give an array of integers, reorder it so that, all odd numbers are before all even numbers. The order among odd numbers is kept. And so are the even numbers. … Read More »

## Solution to Print One To Max Of N Digits from Jobdu

7 Aug

Question (in Chinese): http://ac.jobdu.com/problem.php?pid=1515 Question Name: Print One To Max Of N Digits Question Description: Give an integer N, generate and print all the integers from 1 to (10^N – 1). Input: an integer. Output: the integers from 1 to … Read More »