Day 10: Binary Numbers | HackerRank Solution

learn kro favicon img

Hello coders, today we are going to solve Day 10: Binary Number HackerRank Solution in C++, Java and Python. Objective Today, we’re working with binary numbers. 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. When working with different bases, it is common to show the … Read more

Day 9: Recursion 3 | HackerRank Solution

learn kro favicon img

Hello coders, today we are going to solve Day 9: Recursion 3 HackerRank Solution in C, C++ and Java. Objective Today, we are learning about an algorithmic concept called recursion. Function DescriptionComplete the factorial function in the editor below. Be sure to use recursion. factorial has the following paramter: Returns Note: If you fail to use recursion or fail to name your recursive … Read more

Day 8: Dictionaries and Maps | HackerRank Solution

learn kro favicon img

Hello coders, today we are going to solve Day 8: Dictionaries and Maps HackerRank Solution in C++, Java and Python. Objective Today, we’re learning about Key-Value pair mappings using a Map or Dictionary data structure.  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 … Read more

Day 7: Arrays | HackerRank Solution

learn kro favicon img

Hello coders, today we are going to solve Day 7: Arrays HackerRank Solution in C++, Java and Python. Objective Today, we will learn about the Array data structure. Task Given an array, A, of N integers, print A‘s elements in reverse order as a single line of space-separated numbers. Example A = [1 ,2, 3, 4] Print 4 3 2 1. Each integer is separated by one space. Input Format The … Read more

Day 6: Let’s Review | HackerRank Solution

learn kro favicon img

Hello coders, today we are going to solve Day 6: Let’s Review HackerRank Solution in C++, Java and Python. Objective Today we will expand our knowledge of strings, combining it with what we have already learned about loops. 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 more detail). … Read more

Day 5: Loops | HackerRank Solution

learn kro favicon img

Hello coders, today we are going to solve Day 5: Loops HackerRank Solution in C++, Java and Python. Objective In this challenge, we will use loops to do some math. Task Given an integer, n, print its first 10 multiples. Each multiple n x i (where 1 <= i <= 10) should be printed on a new line in the form: n x i = result. Example n = 3 The printout should … Read more

Day 4: Class vs. Instance | HackerRank Solution

learn kro favicon img

Hello coders, today we are going to solve Day 4: Class vs. Instance HackerRank Solution in C++, Java and Python. Objective In this challenge, we’re going to learn about the difference between a class and an instance; because this is an Object Oriented concept, it’s only enabled in certain languages.  Task Write a Person class with an instance variable, age, and a constructor that takes an integer, initialAge, as a … Read more

Day 3: Into to Conditional Statements | HackerRank Solution

learn kro favicon img

Hello coders, today we are going to solve Day 3: Into to Conditional Statements HackerRank Solution in C++, Java and Python. Objective In this challenge, we learn about conditional statements. Task Given an integer,n , perform the following conditional actions: Complete the stub code provided in your editor to print whether or not n is weird. Input Format A single line containing a positive … Read more

Day 2: Operators | HackerRank Solution

learn kro favicon img

Hello coders, today we are going to solve Day 2: Operators HackerRank Solution in C++, Java and Python Objective In this challenge, you will work with arithmetic operators. Task Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal’s total … Read more

Day 1: Data Types | HackerRank Solution

learn kro favicon img

Hello coders, today we are going to solve Day 1: Data Type HackerRank solution in C++, Java and Python which is the part of 30 Days Of Code Series. Objective Today, we’re discussing data types. Task Complete the code in the editor below. The variables i, d, and s are already declared and initialized for you. You must: Note: If you are using a language that doesn’t support … Read more