Refresh to get another 5 random questions

World Series

A和B两个队比赛,七局四胜制, 没有平局, 哪个队先胜四场比赛就结束。每场比赛之前我都要下注(金额不一定

Post-order traversal of a BST

Determine if a given array can be the post-order traversal
of a binary search tree. For example, [1,3,2] is the post
order traversal of the binary search tree

Dice game

You can roll a 6-side dice up to 3 times. After the first or the second roll, if you get an number x, you can decide either to get x ...

Josephus Problem

Five hundred people labeled with numbers 1,2,…500 sit in a circle. Their label numbers 1,2,…,500 are assigned around the circle clockwise. The first person (the one with label number 1) ...

Generate all possible n! permutations of 1,2,...,n-1,n

Write a program to print all possible n! permutations of numbers from 1 to N. Consider the two different requirements:
(1) do it recursively.
(2) recursion is not allowed.