`

Algorithms

Algorithms is the bread and butter of a person building a career in CS. I write about problems here. This page is not representative of how much I code as I decided not to blog about every problem. I simply write about it in a README in the directory where I write the code. You can check out the latest problems I am playing around with in HackerSpace. This space is reserved for interesting problems (like Google Code Jam questions)!

HackerRank: Frequency Queries

Seemed easy at the start as I misread query 3. I read it as if there exists at least one of this number in the data structure. I tried coding this immediately without writing it on paper, and was stuck pretty quickly or found out I was heading down in...

HackerRank: Is this BST?

I first implemented this using a stack - it wasn’t too hard to get everything up to speed. It was only until I tried submitting it, that HackerRank did not allow me to use additional data structures (or perhaps I could but just didn’t know how). The only other way...

HackerRank: Encryption

A simple problem. Not sure why I’m even writing about it but here goes. It was simply executing it and knowing how to use vector and manipulating the grid well. I first coded on paper, and then wrote the code directly into the HackerRank screen. Made a small mistake in...

HackerRank: Swap Nodes

This question was pretty involved. I never knew that implementing a tree was this hard in C++. In addition to that, I refreshed my knowledge on the various traversals and realized that I’ve totally forgotten about each type of traversal. Once you get the tree data structure right, the question...

HackerRank: ACM ICPC Team

Starting to do HackerRank again. The objective is to do a small problem each day at least, with the option of spilling over to the next day if it is too hard. This question is really simple. N is less than 500, and 500C2 is in the order of O(N^2)....

Google Code Jam Round H

It’s the last Code Jam of the year. I wanted to take part in the previous ones but didn’t make the time to do it. At least I managed to do the last one. Performance was really bad though, only managed to finish the first 2 questions - in a...