Task: Complete the factorial function in the editor below. Be sure to use recursion. factorial has the following paramter: int n: an integer Solution: … Read more
Category: 30 Days of Code
Day 8: Dictionaries and Maps (30 Days of Code)
Task: Given n names and phone numbers, assemble a phone book that maps friends’ names to their respective phone numbers. You will … Read more
Day 7: Arrays (30 Days of Code)
Task: Given an array,A, of N integers, print A’s elements in reverse order as a single line of space-separated numbers. Solution: 1)Javscript: 2)Java:
Day 6: Let’s Review (30Days of Code)
Task: Given a string, S, of length N that is indexed from 0 to N-1, print its even-indexed and odd-indexed characters as 2 space-separated strings on a single line (see the Sample below for … Read more
Day 5: Loops (30 Days of Code)
Task: Given an integer,n , print its first 10 multiples. Each multiple n*i (where ) should be printed on a new line in the form: n x … Read more
Day 4: Class vs. Instance (30 Days of Code)
Task: Write a Person class with an instance variable, age, and a constructor that takes an integer,initialAge, as a parameter. The constructor must … Read more
Day 3: Intro to Conditional Statements (HackerRank – 30 Days of Code)
Task: Given an integer, n, perform the following conditional actions: If n is odd, print Weird If n is even and in the inclusive range of 2 to 5, … Read more
Day 2: Operators(HackerRank – 30 Days of Code)
Task: Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as a tip), and tax percent (the percentage … Read more
Day 1: Data Types(HackerRank – 30 Days of Code)
Task: Complete the code in the editor below. The variables i,d, and s are already declared and initialized for you. … Read more
Day 0: Hello, World.
Task: To complete this challenge, you must save a line of input from stdin to a variable, print Hello, World. on a … Read more