/HackerRank

HackerRank solutions in Python

Primary LanguagePython

HackerRank

This repository contains solutions to my interview's problems on HackerRank, with Python 3.

Alphabet Filter

Given a string, remove the vowels (consonants) from the string and print the string without vowels (consonants).

BinaryTree Search

Featured Product

An e-commerce site tracks the purchases made each day. The product that is purchased the most one day is the featured product for the following day. If there is a tie for the product purchased most frequently, those product names are ordered alphabetically ascending and the last name in the list is chosen.

Maximize the Final Element

Given an array arr[] consisting of N integers, rearrange the array such that it satisfies the following conditions:

  • arr[0] must be 1.
  • Difference between adjacent array elements should not exceed 1, that is, arr[i] – arr[i-1] ≤ 1 for all 1 ≤ i < N.
  • The permissible operations are as follows:
    • Rearrange the elements in any way.
    • Reduce any element to any number ≥ 1.
    • The task is to find the maximum possible value that can be placed at the last index of the array.

Last and Second

Takes the last two letters from an input and print an output that shows just the last two letters but reversed with a space in the middle.

Ones Groups

Prime Or Not

Given a number, return the smallest divisor, if it's prime return 1.

Aladdin and His Carpet