HackerRank - Advance Your Coding Through Problem Solving
Written by Nikos Vaggalis   
Tuesday, 31 May 2016
Article Index
HackerRank - Advance Your Coding Through Problem Solving
Challenging Community

 

Ready for a challenge

The next entry point is the Domains (technically the 30 days of code is a domain itself) which in essence are categorized challenges. There are many categories to choose from such as Data Structures, Algorithms, Artificial Intelligence, Java, Databases, SQL, Security etc.

Each category is split into subcategories, which are subsequently split into the challenges. For example the Databases category is split into the subcategories of:

  • Relational Algebra
  • Indexes
  • OLAP
  • Set and Algebra
  • NoSQL-XML,Mapreduce
  • Database Normalization

In turn Relational Algebra is comprised of :

  • Basics of Sets and Relations #1 through 7
  • Database Query Languages
  • Procedural Language
  • Relations - 1 and 2

The database normalization material looked especial useful,
as it goes from 1NF to 3NF, supplying hands-on material for a concept that you only master after a lot of practice.

Striving for fame and fortune 

As with the 30 days of code, each domain has its own leader-board, with each player's score being calculated from their performance in the rated contests of that domain. A bit of Stackoverflow influence is evident as based on those scores you also collect Badges and Medals.

Scores, points, ranks, badges and medals serve just one purpose: build self confidence to reach a status of fame that earns you job opportunities at top tech companies.

Another way to get fame and money is through the organized hackathons or Contests, which serve as a third entry point. For example, in the May World CodeSprint! you have 24 hours to prove how well you can code by solving 8 new challenges, ranging from basic programming to advanced algorithms.

Top 100 coders will win $15,000 in prizes:

  • 1st place wins $2,000 Amazon Gift Card
  • 2nd place wins $1,000 Amazon Gift Card
  • 3rd place wins $750 Amazon Gift Card
  • 4th through 100th place win $75 Amazon Gift Card  
  • Top 100 win World Champion Shirt

You put your skills to the test and must complete the challenges as fast and as accurately as possible.

We had a go at the Regular Expresso 2 challenge, which although ended was archived and thus still accessible, which required finding the correct regular expression to a series of text patterns, using the following languages: Java, Perl, PHP, Ruby or Python, within 24 hours.  

 

Assigning the scores was well thought out indicating perhaps how seriously the tasks are taken:


Each challenge has a pre-determined score. Your score for a problem depends on the number of test cases your submission successfully passes. A participant's total score is the sum of the scores earned for each problem attempted. If you submitted more than one solution for a problem, only your highest score achieved will be used in this calculation. Participants are ranked by score, with the cumulative time taken (between the contest's start time and the time of your correct submission) used to break ties.

 

and

Please refrain from discussing strategy during the contest. All submissions are run through a plagiarism detector. Any case of code plagiarism will disqualify both users from the contest.

 

The very first challenge was :


Baroo Baroo is a popular new health-conscious restaurant that divides its menu items into  categories, High Calorie and Low Calorie:

High Calorie

Fiesta Omelette
Meat Plate
Prime Rib
Chicken Pasta
Pineapple Blast
Red Lobster
Pizzeria
Steakburger


Low Calorie

Chicken Tacos
Maki Rolls
Warm Chorizo
Courgetti Bolognese
Greek Roast Fish
Euro Pulled Chicken
Egg Foo Young
Szechwan Shrimp
Task

Write a regular expression that matches all of the High Calorie menu item names, and does not match any of the Low Calorie item names. Your regex must pass all test cases, and should be limited to 15 or less characters

We came up with:

$Regex_Pattern = '^[^WGE].*[^sp]$';

which passed all tests except one, matching 'Courgetti Bolognese' when it shouldn't.

 

So where does that leave us? The options are going back to the drawing board, or having a peek at the answer by going through the Editorial tab, something that renders our attempt invalid and collects us no points for it.

This was the answer that DOSHI, the creator of this challenge provided:


To solve this problem, we must look for some kind of pattern.
On careful observation, we see that all high calorie items contain, or  at least twice and separated by one or more characters. Excluding the last high calorie item. For the last item , we match the  at the end.

Problem Setter's code :
The correct regular expression can be : ([tai]).+\1|r$

This also highlights that the platform and its materials and challenges, are made by Programmers for Programmers.

Wrapping up, the platform is a great hangout for programmers no matter their experience, who want to learn their language or domain of choice, in depth, or gain experience of a brand new one.  And what better way to do that than hands-on problem solving.  You get involved with the programming paradigms and bolster algoritmhic thinking by getting into challenges on Data Structures, Stacks, Queue, Arrays, Dictionaries, Search algorithms, Greedy algorithms and more.

After mastering the general concepts you can advance to more specific subjects like Graph Theory, Mathematics, Game Theory or Artificial Intelligence.

Finally, challenges, games and potential tech interviews play a role in keeping you excited so you keep putting more effort into it, which reveals the pedagogical design behind the platform of the more effort you put the more knowledge you gain...

 

hackerrank logo

More Information

30 days of code

Warmup Challenges

Contests

Hackathon

Related Articles

Free Code Camp - Not Just A Bootcamp

Skillset - Pass Your Certification Exam

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

{loadposition moreNEWS}

{loadposition moreNEWSlist}

 

{loadposition comment}

 

     



Last Updated ( Wednesday, 07 December 2016 )