An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once. For example, the word anagram can be rearranged into nag a ram, or the word binary into brainy or …

Read More## Balanced parentheses

Given strings of brackets, determine whether each sequence of brackets is balanced. If a string is balanced, return YES. Otherwise, return NO.

Read More## Pascal’s triangle/ pyramid

Given a non-negative integer numRows, generate the first numRows of Pascal’s triangle. In Pascal’s triangle, each number is the sum of the two numbers directly above it. Complexities : Time = O(n^2) and Space = O(n^2)

Read More## Count the string occurrences

You are given two strings T and P. Write a program, which counts how many time P is found in T. If different occurrences of P in T overlap count each one of them. Here is an example: T = babalabalabalatheend P = alabala The …

Read More## Group words with same set of characters

Given a list of words with lower cases. Implement a function to find all Words that have the same unique character set . Example:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Input: words[] = { "may", "student", "students", "dog", "studentssess", "god", "cat", "act", "tab", "bat", "flow", "wolf", "lambs", "amy", "yam", "balms", "looped", "poodle"}; Output : looped, poodle, lambs, balms, flow, wolf, tab, bat, may, amy, yam, student, students, studentssess, dog, god, cat, act, All words with same set of characters are printed together in a line. |

Solution

Read More## Codility Challenge: BinaryGap

A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N. For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has …

Read More## Codility Demo task: MissingInteger

This is a demo task. Write a function: def solution(A) that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in A. For example, given A = [1, 3, 6, 4, 1, 2], the function …

Read More## Codility challenge: Minimum number of steps to reduce number to 1

A non-negative integer variable V is given. There are two actions available that modify its value: if V is odd, subtract 1 from it; if V is even, divide it by 2. These actions are performed until the value of V becomes 0. For example, …

Read More## Andela Qualified.io assessment: Question 2

Task Given the following class: complete the function which compares the two trees defined by TreeNodes a and b and returns true if they are equal in structure and in value and false otherwise. My solution My tests

Read More## Andela Qualified.io assessment: Question 3

Task Mary is a famous shopkeeper who sells n items in her shop. She assigns each item a unique popularity rating in the inclusive range from 1 to n. The shop only has one shelf, so the items are displayed array-style in a single row spanning from left …

Read More