/java-practice

Examples of solved tasks from the area of simple algorithms, operations on Lists, Strings, Streams etc.

Primary LanguageJava

Simple algorithms and collections in Java exercises

Introduction

This GitHub project was created to serve as a playground for practicing simple algorithms, Java Stream API and Java collections.

IDE Setup

This project uses Lombok Library which a java library that automatically plugs into your editor and build tools, spicing up your java.

To configure your IDE for the support of Lombok, check out the official documentation for detail.

Exercises

Java Stream API

There are exercises which introduce the Stream API usage including filtering, sorting and the output to various formats. 1.Find 1 element on the lists which starts with given letter/word. 2.Find first/last element in the list. 3.Sort elements on the list in reverse/natural order. 4.Eliminate duplicates in the list.

Simple algorithms

  1. Change making problem addresses the question of finding the minimum number of coins that add up to a given amount of money. It is a special case of the integer knapsack problem.

Java Math Exercises

  1. Count the average of 3 integers.
  2. Calculate average value of integers from a list.
  3. Calculate factorial for injected integer.
  4. Find n-th element from the fibonacci sequence.

Java String Exercises

1.Check if text is a Palindrome. 2.Reverse the String.

Java List Exercises

  1. FizzBuzz exercise
  2. Find 2 the smallest numbers from the list. Ignore the repetitions.
  3. Find 2 elements in list whose sum is closest to zero.
  4. Find first element in the list starting with letter "A" with the usage of Regex.