Convert Column Number to Excel Column [Objective-C]

Problem:

How would you determine the column name (e.g. “AQ” or “BH”) of the nth column in Excel?

Solution can be found here.

Advertisements

Finding Anagrams using Objective-C

TL;DR: Solution can be found here.

Problem:

Given a list of words and a single word I had to find out if that single word is an anagram with any of the words in the list and return those words that are anagrams in an array.

Solution:

  1. A way to go about it is to sort the ‘single word’ and the list of words in the ‘array’ in alphabetical order.
  2. Compare the sorted strings in the array with the ‘single word’
  3. If equal, bingo, you have an anagram.

Bracket Validator using Objective-C

I have been asked the BracketValidator interview question twice now; It’s comparatively easy to formulate a Python/Java solution using the fancy data structures and built-in methods that Python/Java offers. So, I tried my hand solving this using Objective-C.

TL;DR: Solution can be found here.

Problem:

In short, given a string containing brackets and parenthesis, every bracket opened i.e. ‘{‘, ‘(‘, ‘[‘ should have a corresponding closing bracket i.e. ‘}’, ‘)’, ‘]’. Note, the position of the closing bracket is important.

The following string will be valid:

{([()])}
But, the following won’t be correct:
{[}]

A more apt description of the BracketValidator can be found here.

My github gist of the working solution can be found here.