Problem: A natural number is said to be a Narcissistic Number if the sum of its digits each raised to the power of the total number of digits is equal to that number. eg. 153 = 1^3 + 5^3 + …

#### Code with Narendran Articles.

The power set of a set is the set of all its subsets. Write a function that, given a set, generates its power set. For example, given the set {1, 2, 3}, it should return {{}, {1}, {2}, {3}, {1, …

Given an integer list where each number represents the number of hops, you can make, determine whether you can reach to the last index starting at index 0. For example, [2, 0, 1, 0] returns true while [1, 1, 0, 1] returns false. Problem Explanation: In the …

Coding Problem: Write a function that rotates a list by k elements. For example, [1, 2, 3, 4, 5, 6] rotated by two becomes [3, 4, 5, 6, 1, 2]. Try solving this without creating a copy of the list/array.

Run-length encoding is a fast and simple method of encoding strings. The basic idea is to represent repeated successive characters as a single count and character. For example, the string "AAAABBBCCDAA" would be encoded as "4A3B2C1D2A".

Ruby Coding Problem: Given an array of strictly the characters ‘R’, ‘G’, and ‘B’, segregate the values of the array so that all the Rs come first, the Gs come second, and the Bs come last. You can only swap …

Coding Problem: Given an array of integers, write a function to determine whether the array could become non-decreasing by modifying at most 1 element. For example, given the array [10, 5, 7], you should return true, since we can modify the …

Perfect number problem: A number is considered as a perfect number if the sum of its digits up to exactly 10. ie. 19, 28, 37 are perfect numbers. Given an integer n, write a function to return n-th perfect number.For …

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 a palindrome. Also, see: Mi10 5G …

Implement the function fib(n), which returns the nth number in the Fibonacci sequence, using only O(1) space in ruby. Fibonacci is the sequence of numbers 0,1,2,3,5,8,13….. The new number is found by adding up the two numbers before it. Our task is to …