Going through sites like Hackerrank and leetcode i realize that i even have a hard time trying to go through some of the array based problems that those sites deem as easy.
Are there any sites or other resources that would help me re strengthen my understanding of algorithms and how to go about those types of problems?
Top comments (5)
Both HackerRank and Leetcode's questions are less clear compared with real world questions, they are useful when you are preparing coding interviews for big companies.
If you are looking for a website for sharpening your programming skill, I recommend codewars because:
Yeah their descriptions and naming conventions (sheesh who as a developer has ever had the BA tell you what to name your functions and variables!)are not just hard to understand they probably wouldn't pass code review!
I think that HackerRank reaaaaaaaaaaaaalllllllly sucks! The types of problems that they are asking you to solve these very specific questions about how to manipulate values in an array are just things that I rarely see in real practice.
What i really don't like about them though is.. for many of these kinda of questions, If I encountered them in the real world, I'd google for newer solutions, review other peoples suggestions , implement and then test.
Maybe this is a naive perspective but to me it seems like HackerRank is taking a position that whatever solution they have come up with is THE solution. I think that valuing the skills it takes to be good at these is really short sighted by employers. :S
Just reading through their problems makes me want to go find a different profession!
Check out @vaidehijoshi 's articles and videos. Might be very helpful to you.
Thank you so much! Also glad to be a part of this site.
Let's take one of these easy problems apart.
HackerRank says:
A left rotation operation on an array shifts each of the array's elements 1 unit to the left. For example, if 2 left rotations are performed on array , then the array 1,2,3,4,5 would become 3,4,5,1,2 .
Given an array a of n integers and a number, d, perform d left rotations on the array. Return the updated array to be printed as a single line of space-separated integers.
In the real world I would say (if describing this problem to a developer)
OK we have a system that is going to return a series of numbers
1,2,3,4,5.
We have this other process that is going to do Something and that is going to result in all of the numbers shifting to the left ,each time it that process occurs.
So if Something happens 2 times then our collection will look like this :
3,4,5,1,2
You see, each of the elements stay in our collection but are moving left, starting over at the end of the array if they are moved past the beginning.
The second part of this problem is to me just incomprehensible.. I have to read it over 4 or 5 times because they are using such poorly named variables.
**
Given an array a of n integers and a number, d perform d left rotations on the array. Return the updated array to be printed as a single line of space-separated integers.**
So the numbers we have to work on will be stored in an int array, and we don't always know how many *elements * there will be in our array.
We will need to write some code that can accept an **int **that tells us how many rotations to perform on the array.
Our function will then shift the values in the array one time to the left for each rotation. (Numbers that reach the first position of the array will be moved to the end of the array)
To me my definition is just so much more easy to understand. Is that the point? Are they giving us a code test or are they testing if we can do the mental back flips that are required to read their poor descriptions?