Day 10 Binary Numbers

输入一个正整数,转为二进制将二进制中连续的1的个数的最大值求出来。

Task Given a base-10 integer,N , convert it to binary (base-2). Then find and print the base-10 integer denoting the maximum number of consecutive 1's in N's binary representation.

Read More

Days 9 Recursion

利用递归算法求阶乘。这个破系统不知道怎么回事,我都提交了,却显示我明天才能看题目。

Task Write a factorial function that takes a positive integer, N as a parameter and prints the result of N (N factorial).

Note: If you fail to use recursion or fail to name your recursive function factorial or Factorial, you will get a score of 0.

Read More

Day 8 Phone a Friend

Task Given n names and phone numbers, assemble a phone book that maps friends' names to their respective phone numbers. You will then be given an unknown number of names to query your phone book for. For each name queried, print the associated entry from your phone book on a new line in the form name=phoneNumber; if an entry for name is not found, print Not found instead.

Note: Your phone book should be a Dictionary/Map/HashMap data structure.

Read More