Find the missing element between two arrays in Python
The challenge
Given two integer arrays where the second array is a shuffled duplicate of the first array with one element missing, find the missing …
Read Article →In-depth guides, insights, and best practices for modern software engineering
Given two integer arrays where the second array is a shuffled duplicate of the first array with one element missing, find the missing …
Read Article →Consider an array/list of sheep where some sheep may be missing from their place. We need a function that counts the number of sheep …
Read Article →You are driving a vehicle that has capacity empty seats initially available for passengers. The vehicle only drives east (ie. it cannot …
Write a function called repeat_str which repeats the given string src exactly count times.
repeatStr(6, "I") // "IIIIII" …
Read Article →
Given an array of integers your solution should find the smallest integer.
For example:
[34, 15, 88, 2] your solution will return …Given a number n, return the number of positive odd numbers below n, EASY!
oddCount(7) //=> 3, i.e [1, 3, 5]
oddCount(15) //=> 7, …
Read Article →
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word (last word means …
Given a random non-negative number, you have to return the digits of this number within an array in reverse order.
import …
Read Article →
On a 2-dimensional grid, there are 4 types of squares:
1 represents the starting square. There is exactly one starting square.2 …Find the mean (average) of a list of numbers in an array.
To find the mean (average) of a set of numbers add all of the numbers together …
Read Article →BMI stands for Body Mass Index and is a value derived from the mass and height of a person. The BMI is defined as the body mass divided …
On an infinite plane, a robot initially stands at (0, 0) and faces north. The robot can receive one of three instructions: …
We need a function that can transform a string into a number. What ways of achieving this do you know?
Note: Don’t worry, all …
Read Article →Given a non-negative integer n, write a function toBinary/ToBinary which returns that number in a binary format.
to_binary(1) /* should …
Read Article →
Exclusive “or” (xor) Logical Operator
In some scripting languages like PHP, there exists a logical operator (e.g. &&, ||, and, or, …
Write a function that merges two sorted arrays into a single one. The arrays only contain integers. Also, the final outcome must be …
Read Article →Your job is to find the gravitational force between two spherical objects (obj1 , obj2).
arr_val (value array), …It’s a common requirement to be able to zoom in or out while working in the code editor in IntelliJ Idea.
This is achieved on Windows with CTRL+ …
You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number …
Read Article →Given a binary tree, each node has value `` or 1. Each root-to-leaf path represents a binary number starting with the most significant …
Remove a exclamation mark from the end of string. You can assume that the input data is always a string, no need to verify it.
Let’s play Rock Paper Scissors! You have to return which player won! In case of a draw return Draw!.
Create a function close_compare that accepts 3 parameters: a, b, and an optional margin. The function should return whether a is lower …
It’s the academic year’s end, fateful moment of your school report. The averages must be calculated. All the students come …
Read Article →