Tag Archives: Minimum Absolute Difference in an Array

HackerRank : RookieRank 2 – HackerRank in a String!

HackerRank in a String! Source : Hackerrank We say that a string, , contains the word hackerrank if a subsequence of the characters in spell the word hackerrank. For example, haacckkerrannkk does contain hackerrank, but haacckkerannk does not (the characters all appear in the same order, but it’s missing a second r). More formally, let be the respective… Read More »

HackerRank : RookieRank 2 – Minimum Absolute Difference in an Array

Minimum Absolute Difference in an Array Source : Hackerrank Consider an array of integers, . We define the absolute difference between two elements, and (where ), to be the absolute value of . Given an array of n integers, find and print the minimum absolute difference between any two elements in the array. Input Format The first line contains… Read More »