Hey, It’s been a great journey. I started from scratch, and now I have published more than 50 blogs. Each blog deals with specific questions from the hacker rank Coding challenges.
In this list, I am going to attach the top 50 blogs and a short description of what that blog is all about. With the help of these 50 programs, You can also achieve a gold badge in the hacker rank coding challenges in the Algorithms Section.
I have published an ebook. A compilation of 100 Java(Interview) Programming problems which have been solved . I have given clear explanation and the code in the book. Believe me when I say, this will kick start you to achieve the job at your dream company.
Click on this link to get you to the landing page. It is completely free when you use kindle amazon. Take a look at it.
I have also a series which is focused on top tech companies like Google, Amazon, Facebook, Quora, Youtube, Linkedin. etc, Take a look at that!
100 Days to Amazon — Day 1
Hey Guys, From today. I am challenging myself to solve 1 problem each day for 100 days.
Let’s go straight ahead to the problems that made me scratch my head and How I solved them.
This program was the inception of my Blogging Career :). This problem is nothing but a Simple Array Sum. The intention of this program is to find out the sum of the given elements in the array. And give you a gist on what we will be doing throughout this journey.
Top Programming Language Books to Read this 2019
Hey there folks, It’s the end of the first month of 2019 . Each and Everyone of us had made up different resolutions…
Uhm! Pattern Printing is the most underrated programming logic ever. There are literally infinite amount of patterns that could be asked in an interview. The possibilities for the question might be infinite but the solution could become finite if you know the 2 Principles that lurks in the shadows. What are you waiting for then? Click on the title. To shed light on the Principles.
Well well well, If you do not know this Class by now. You have to make sure that you make yourself the time to learn this Class and its functions. In various coding competition, This Class has come to my aid when I am put up against Large numbers. To find out What this class is all about, Click on the Heading.
Consider finding the minimum and the max element to be the pit stop for any Graders*.Whenever they need a refuel, or when there is a slight breakdown in their system of questions. They would always rely on the pit stop Crew. Which is led by questions Covering Minimum and Maximum Elements. The graders of various Competitions would ask questions regarding this topic in a convoluted way, So that we the programmers do not understand that this is the question asked.
* A grader is someone who comes up with the question for interviews or coding challenges.
Find a repeating Character in Linked List
In a given LinkedList (where each node has a character), there is one character which appears twice.
This program introduces to the concept of positive and negative elements in the array. Until this program, We would have dealt with only positive numbers. From this program, We started to write programs for negative as well as positive elements also. This program taught us to keep in mind of the constraints that are posed in the question.
6) Mini-Max Sum
When you drive straight through the tornado (programming world). You will be lurched around various structures. From loops to complex data structures. But A certain Structure which could remain rigid throughout the thunderstorm is the one that envelops all these complex structures, which is the Simple If-else Structure. Remove the Efficiency factor, Most of the Programs can be solved using simple if-else statements.
This program introduces the user to the topic of if else structures. This deals with how you delineate an if condition based on the given stipulation. You have to compare and find out the points that has to be given to the winner.
This program deals with finding the maximum element present in the array. You would be surprised, how most of the problems require us to find the maximum element in the array. It is a must for a programmer to know the logic behind, Finding out the maximum or minimum element in an array.
This program deals with grading students based on the given stipulations. This is how most of the grading system works in most of the colleges. There will be more constraints in real life. But, here it is simplified more, With only one stipulation.
This program gives you a different outlook in solving a problem. While Solving this program, I wanted to reduce the number of loops from the original source code. Since it takes up too much time for repeating the same steps. So, I reduced the number of loops, to solve this program with only one loop.
How Learning Bayesian Networks Helps you in saving your job(AI Series)
Hey guys, Thank you for supporting House of Codes. We take pride in introducing our new Series of Coding Challenges…
To Be honest, Implied Conditions are present in most of the questions. And they do not affect the result, even if it goes unnoticed by the programmer. But Certain problems, such as this one will give you a twirl. If you let the Condition get overlooked. So I would like you to go through this program to understand what an Implied Condition is. And make sure that you won’t be disregarding the importance of Implied Condition in your next Interview.
Well, Here comes the structure which is Second only to If-else Structure. The Nested Loop Structure. Nested Loops help the programmers, Solve the problems while traversing for the first time itself. Rather than having to go through all the array iteratively . And saves us from repeatedly writing different loops to do the same thing over and over again. This program marked the beginning of using nested loops instead of solving through if-else structures.
This program gives you a different perspective while handling a problem. This poses the question whether you could solve a problem while reading for the values itself. If we can solve a problem while the user enters the data into the array itself. It reduces Computational Time and also reduces the Memory Storage. I would ask you to go through this program at least once. Because, This would give the insight for you in reducing the number of lines with which you code.
Oh, Yes. Window Sizes Problem are one of the tough logic to encounter. But When learnt, It will aid you in solving problems that involve anything in the range of Permutations and Combinations. Permutations within the array can be encountered using Window Sizes Problem only. Each window has different lengths. Starting from [1 … n].
15) Brute Force?
If you had been following my blog posts, You would know How much I am interested in Solving a particular Problem Using Mathematical Equations. It is an understatement to say that Math plays a role in everybody’s life. Mathematical Equations aids the programmer in replacing the complex structures with Simple equations. It does Save us a lot of Code Space.
This problem is nothing but a simple array sum with some more calculations such as subtraction. This program deals with the intertwining of array sum and subtraction of certain elements from the array. And the catch is that we use only one variable to do all these calculations.
Ooh, You have to Know about this problem Solving Technique. It kind of resembles the Divide and Conquer Approach. But it varies from this approach in a way that there can be two or more outcomes based on the content present in the input. Cleft Problem Solving will come handy to you when the outcome varies when the input varies.
Apart from the if-else structure. It could get a slightly complex but the result would be much more detailed. That is the strong suit of nested if else structure.
This is also a min- max problem. The only difference from its predecessor is that instead of checking for the value directly. We have to find out the occurrences of each element in the array. And Produce the output which deals with the maximum of the elements that are occurring repeatedly.
Dummy values are temporary changes in the given input. There are certain problems, which involves in inputs after visiting once, it becomes redundant. These inputs if not changed will change the after effect of the problem. In order to ensure that there are no changes in the outcome due to these redundant variables. You have to know about dummy values. But The answer to the question whether dummy values expedite the process of solving, rests in you to find out by clicking on the Title :).
This is the Second program which uses nested loops for the solution. The twist is in the sense that a normal array sum can be mixed with a nested loop structure and the problem could make you miserable.
This is a simple game which decides the fate of the mouse. It could either end up in the Mouse getting Triumphant. Or it could end in Horror stricken end for the Mouse. We have to predict the outcome from the given input. This program aids you in understanding the need of the ABS function in Math class in Java.
The use of Sorting Algorithms, Only when a sort is required or mentioned in the question is a bland way of using the sort function. A Well-Known Fact about Sorting is that it can be used to solve various problems. At the beginning itself. Use this tip in solving various problems. If there is a chance for sorting, There is a possibility that it can be solve with efficiency.
This program asks us to find out the distance between two same numbers present in the array. And find out the minimum distance between two such element. Instead of using O(n²) naive approach. We could solve it in O(n). This is the answer for the previous blog. How a simple sort changes the O(n²) approach to O(n).
Well This serving is a mixture of Implied Conditions and Min max problems saute together and served in a platter of illusive sentences. Here, We find the application of the implied conditions that I have talked earlier in the 11th Blog. You would find why this is important, When you go through this program.
In this problem, you will find out the question is represented in a convoluted way. It’s intention is to make you digress from the answer which is right in front of you. It is a normal Multiplication problem, but when you pore over the question, I am confident that You will figure out the reason.
This problem is what you would call a counting problem. It’s crux is that it requires some number of elements based on a certain Stipulation. Counting problem’s are widespread from counting the elements in an array to Counting the next greater element present for a certain element within the array. This program is the commencement of the various counting problem which we will come across later.
Okay, From this problem onward. You should be knowing the basic functions in Math Class. To assist you with this, This program deals with the rounding off functions in Math Class in Java. They are Floor and Ceil functions. Flooring and Ceiling Functions are required when you convert a double or float variables into an integer. After this program, you will be able to boost your abilities in Solving problems using Math Class in Java.
As the name suggests, We are dealing with a Linear Search Algorithm. This is search Algorithm which works under O(n). It helps the programmer to find the specific element from the given sequence.
We are going through one of the most referred logic in solving problems. They are Reversing the value of a number. At the first look, it’s simple. Because we are thinking to solve it in a non programmatic way. Actual reversing of digits requires Multiplication and Modulo Operations done in a sequence to get the reversal right. The following program helps you in gathering knowledge about reversing a digit.
O(n) traversal represents the fact that the answer could be produced with only one traversal through the whole array. This problem introduces you to the concept of O(n) traversals.
Next to dummy values, That are used when there is no use of that variable after a single traversal. Flag variables are something different, they are decision making variables that comes to the rescue when a cleft problem solving is involved. The decision to print a yes or no will eventually depend on the value of a flag variable. Do learn about flag variables by clicking on the title.
Never forget the basics. This is why this simple if-else problem has come up in this position. After delving deep into complex nested loops and sorting functions. It is refreshing to solve a simple problem with an if-else structure. So that,This does not overload your brain.
Well Max and min problems are present in most of the coding competitions. Only that they are disguised in question as something else. When you read through this question you will understand the reason.
As I have told earlier, Mathematical Equations aids the programmer in replacing the complex structures with Simple equations. It does Save us a lot of Code Space. This program is another such example, where A hefty programming logic can be overcome with the help of a simple mathematical equation. Mathematical equations are a blessing for us programmers. You will come to extrapolate when you have gone through this logic.
This embarked my journey into Strings. Most of the problems that I come across which uses String as an Input. I convert them into a character array and Solve them. I don’t know why, But I found this approach way more comfortable to me. Instead of Using Pre-defined Functions. Maybe, The experience that you gain when You get to write your own functions is the reason behind my sheltered outlook. You could peruse the contents and tell me, Which approach You find amusing. I would cherish your responses.
This is also a counting Problem. Here we have to find out the the minimum number of jumps required to reach the end. Whenever 1 variable can be used to solve a program then it is a counting Problem.
I always ask a programmer who is starting his career as a coder. To learn one sorting algorithm. And it has to be in his fingertips. He should not waste time in writing a code for sorting function when he should be outstripping the problem in hand. No matter what the sorting algorithm is, Take one and understand the logic. Whenever asked to write a sort function. You should be able to come up with that logic.
This Class has never let me down, when it comes to solving problems, that handles large values.To find out What the functions in this class is all about, Click on the Heading.
As I have told earlier, Mathematical Equations aids the programmer in replacing the complex structures with Simple equations. It does Save us a lot of Code Space. They are the best way of representing 100 lines of code in a single equation. Here is another blog which deals with solving a program mathematically. Math makes our lives easier. Math makes our code simpler.
Apart from the if-else structure. It could get a slightly complex but the result would be much more detailed. That is the strong suit of nested if else structure.
This is also a counting problem. The problem asks us to find out the number of triplets. That equal the value of d. we could solve this problem in O(n³). In order to reduce the number of traversals. We introduce a new condition. By doing so, we could reduce the number of traversals significantly.
This problem introduces us to the concept of increasing the memory space to increase the efficiency of solving the problem. This program does increase the extra space and increases the speed in which the problem is solved. Read through the code to understand the logic.
Well till now, We have not used any of the complex data structures. Hash Maps are not complex but are very useful when it comes down to String retrieval Problems. Whenever a dictionary resembling data structure is required you have to solve it using Hash Maps. When and Where to use hash maps is what this particular blog deals about.
Splintering Number into digits is the process of separating each digit from a number. Like the reversal of a number, This programming logic has also been asked in various coding competitions. This kind of logic would be a pre-requisite in solving various problems. (i,e) The answer would not be found after splintering is done. You have to perform certain operations on the splintered digits and then you have to produce the output.
Whenever 1 variable is used to solve the problem. It is a counting problem. The problem has asked us to find out the number of chocolates that user eats by exchanging the wrappers. In counting problems, it is important to know what you are going to count. This will be mostly present in the question. But sometimes it might end up as implied conditions. Watch out for these type of questions.
Certain programs, ask you to do the same set of basic work, over and over again. If you introduce a loop that does this basic set of operations repeatedly. It might result in a Run time Error. In order to avoid this, we must reduce the number of times the basic operations are done. This can be done by finding out certain logic that can abate the number of operations. This program helps you in how to find such logic.
Sometimes, The creators for coding challenges disguise a simple answer with a complex question lining. The problem might create distractions, So that you would be left confused. But the answer would have been right next to you, and you would not have noticed. The problem mentioned below does just this. You could find more about by perusing through the explanation and algorithm.
This problem deals with the flag variables and min max problems. lag variables are something different, they are decision making variables that comes to the rescue when a cleft problem solving is involved. The decision to print a yes or no will eventually depend on the value of a flag variable.
This is a combination of min max, counting and String retrieval problem. This is the final program of the 50 blog series. After solving all these problems in hacker rank you will receive a gold badge in the algorithms section. This is what I had worked for.
Well guys, I thank you for all your support. Past few days have been boorish. I live by the motto Anybody could code. All it takes is some hard work. And a guide to clear your doubts. Without the help of my mentor, I would not be able to become a coder. He cleared my doubts whenever I had them. And He will not give the answer directly but he will make you understand the logic behind the question.
Whenever you guys have a doubt, regarding these problems. Share your Thoughts with me. I would do my best to clear those doubts.
No Single Solution exists to a problem.Work on the Code. These problems are from HackerRank.
You can follow House of Codes to receive updates when we post new coding challenges. Also you could send us your solutions or your ideas for any coding challenge. We would be thrilled to read them. :)