Solution public int gauss(int[] sequence) { long lastValue = sequence.length + 1; long total = (lastValue * (lastValue + 1)) … More

# Tag: Algorithms

# An algorithm which calculates the minimal quantity of steps to walk from a point to another.

Knowing that A is the starting point B is the destination point D is the step size Assume that A, … More

# What is the Big-O?

The big-o notation is a relative representation of the complexity of an algorithm. In simple words, it means that this … More

# An algorithm that turns an integer into binary and returns the biggest amount of zeros in the ranges which are between the character “1” of it.

import java.util.*; class Algorithm { public int[] algorithm(int Num) { return Arrays.stream( Integer .toBinaryString(Num) // turn to binary .replaceAll(“(^0+|0+$)”, “”) … More

# An algorithm which shifts each element of the Array to the right N times.

import java.util.*; class Algorithm { public boolean isEmptyArray(int[] Arr ){ if ( Arr == null || Arr.length == 0) { … More

# [Algorithms] – Find words in reviews of hotels

Problem: Given a set of words and many review of this hotels, you must display the hotels Ids containing in … More

# [Algorithms] – The sum of pairs

Problem : Given a set of numbers, you need check if has two numbers in this set that the sum … More

# [Algorithms] – Codility Training – BinaryGap

Below is my solution for : https://codility.com/demo/take-sample-test/binary_gap/ public static void main(String[] args) { System.out.println(solution(328)); } public static int solution(int N) … More