注册一亩三分地论坛,查看更多干货!
您需要 登录 才可以下载或查看附件。没有帐号?注册账号 
x
Question1
def solution (N)
that, given a positive integer N, prints the consecutive numbers from 1 to N, each on a separate line. However, any number which is a power of 2 should be replaced by the word POWER. For example, number 4 should be replaced by POWEr, but number 5 should not. The function shouldn't return any value.
Question2There are three stacks of disks. Disks on each stack are sorted by size in increasing order from the bottom to the top.
Our goals to move all disks from these stacks onto the fourth stack, which is initially empty. In one move the top element of one of the stacks can be moved to the fourth stack. After moving all disks onto the foN1, N2 and N3 are integers within the range (0.. 100); each element of arrays stacki, stack2 and stack3 is and integer within the range (1.1,000);
• disk sizes are unique, i.e. there are no two disks of the same size;
• on each stack disks are sorted by size in ascending order.
In your solution, focus on correctness. The performance of your solution will not be the focus of the assessment. |