## String permutation is a palindrome? (Typescript)

My solution to a “Daily Coding Problem” that I received in my mail today. Given a string, determine whether any permutation of it is a palindrome. For example, carrace should return true, since it can be rearranged to form racecar, which is a palindrome. daily should return false, since there’s no rearrangement that can form Read more…

## Exponentiation done recursive & iterative with Bitwise

My solution to a “Daily Coding Problem” that I received in my mail today. Implement integer exponentiation. That is, implement the pow(x, y) function, where x and y are integers and returns x^y. Do this faster than the naive method of repeated multiplication. For example, pow(2, 10) should return 1024. Here’s my solution in Typescript. I will be honest, Read more…

## Find an element that appears more than half the time (Typescript)

My solution to a “Daily Coding Problem” that I received in my mail today. Given a list of elements, find the majority element, which appears more than half the time (> floor(len(lst) / 2.0)). You can assume that such element exists. For example, given [1, 2, 1, 1, 3, 4, 0], Read more…

## Partition into two equal subsets problem (Typescript)

My solution to a “Daily Coding Problem” that I received in my mail today. Given a multiset of integers, return whether it can be partitioned into two subsets whose sums are the same. For example, given the multiset {15, 5, 20, 10, 35, 15, 10}, it would return true, since we Read more…

## Replace adjacent pixels in a 2-D matrix | Floodfill (Typescript)

My solution to a “Daily Coding Problem” that I received in my mail today. Given a 2-D matrix representing an image, a location of a pixel in the screen and a color C, replace the color of the given pixel and all adjacent same colored pixels with C. For example, given the Read more…