title-img


String Function Calculation

Jane loves strings more than anything. She has a string with her, and value of string over function can be calculated as given below: Jane wants to know the maximum value of among all the substrings of string . Can you help her? Input Format A single line containing string . Output Format Print the maximum value of f(s) among all the substrings ( s ) of string t. Constraints 1 <= | t | <= 10^5 The string consists of lowercase English alphabets. Sample Input 0

View Solution →

Build a Palindrome

You have two strings, and . Find a string, , such that: can be expressed as where is a non-empty substring of and is a non-empty substring of . is a palindromic string. The length of is as long as possible. For each of the pairs of strings ( and ) received as input, find and print string on a new line. If you're able to form more than one valid string , print whichever one comes first alphabetically. If there is no valid answer, print instead. Input Format The first line c

View Solution →

Gridland Provinces

The Kingdom of Gridland contains provinces. Each province is defined as a grid where each cell in the grid represents a city. Every cell in the grid contains a single lowercase character denoting the first character of the city name corresponding to that cell. From a city with the coordinates , it is possible to move to any of the following cells in unit of time (provided that the destination cell is within the confines of the grid): A knight wants to visit all the cities in Gridland. H

View Solution →

Big Sorting

Consider an array of numeric strings where each string is a positive number with anywhere from 1 to 10^6 digits. Sort the array's elements in non-decreasing, or ascending order of their integer values and return the sorted array. Example Return the array ['1', '3', '150', '200']. Function Description Complete the bigSorting function in the editor below. bigSorting has the following parameter(s): string unsorted[n]: an unsorted array of integers as strings Returns string[n]

View Solution →

Intro to Tutorial Challenges

About Tutorial Challenges Many of the challenges on HackerRank are difficult and assume that you already know the relevant algorithms. These tutorial challenges are different. They break down algorithmic concepts into smaller challenges so that you can learn the algorithm by solving them. They are intended for those who already know some programming, however. You could be a student majoring in computer science, a self-taught programmer, or an experienced developer who wants an active algorithms

View Solution →