Number of ways to Construct the Array
September 16, 2021Your goal is to find the number of ways to construct an array such that consecutive positions contain different values. Specifically, we…
Your goal is to find the number of ways to construct an array such that consecutive positions contain different values. Specifically, we…
In this challenge, you will be given an array and must determine an array . There is a special rule: For all , . That is, can be any…
You are given two arrays, A and B, both containing N integers. A pair of indices is beautiful if the element of array is equal to the…
Marc loves cupcakes, but he also likes to stay fit. Each cupcake has a calorie count, and Marc can walk a distance to expend those calories…
Watson gives Sherlock an array of integers. Given the endpoints of an integer range, for all M in that inclusive range, determine the…
Alice is a kindergarten teacher. She wants to give some candies to the children in her class. All the children sit in a line and each of…
There are two n-element arrays of integers, A and B. Permute them into some a and b such that the relation a[i] + b[i] >= k holds for all i…
You will be given a list of integers,arr, and a single integer k. You must create an array of length k from elements of arr such that its…
Whenever George asks Lily to hang out, she’s busy doing homework. George wants to help her finish it faster, but he’s in over his head! Can…
In the previous challenge, you wrote code to perform an Insertion Sort on an unsorted array. But how would you prove that the code is…
Problem description The median of a list of numbers is essentially its middle element after sorting. The same number of elements occur…
Problem description You are given 3 numbers a, b and x. You need to output the multiple of x which is closest to pow(a,b). If more than one…
Problem description Given a list of integers, count and return the number of times each value appears as an array of integers. Input format…
Given problem statment HackerLand National Bank has a simple policy for warning clients about possible fraudulent account activity. If the…
Given problem statment In Insertion Sort Part 1, you inserted one element into an array at its correct sorted position. Using the same…
Given problem statment Sorting One common task for computers is to sort data. For example, people might want to see all their files on a…
Given problem statment A space explorer’s ship crashed on Mars! They send a series of SOS messages to Earth for help. Letters in some of…
Given problem statment Dothraki are planning an attack to usurp King Robert’s throne. King Robert learns of this conspiracy from Raven and…
Given problem statment In this challenge, you will determine whether a string is funny or not. To determine whether a string is funny…
Given problem statment A numeric string, s , is beautiful if it can be split into a sequence of two or more positive integers, solution in…
Given problem statment Sherlock considers a string to be valid if all characters of the string appear the same number of times. It is also…