Algorithms – Page 2 – IT Blog
IT Blog
Boris IT Expert

# The best solution if the sum of the elements exists in an Array List (Java)

November 9, 2020

### The best solution if the sum of the elements exists in an Array List (Java)

How to check if the sum exists in an Array List in Java. The sum of what elements equal to the needed value in the Array List (Java)? One of the most commonly asked problems on the technical interview. The basic idea here is to start two loops and check if the sum of the […]

November 9, 2020

### How to find duplicate in an Array List Java?

How to find duplicate in an array Java? One of the most frequently asked questions on the technical interview. And one of the most straightforward solutions. The only thing you need to do is to convert an array list to the set. And point the element that we can’t add. Why? Because the set collection […]

November 6, 2020

### Two sum problem in Java. The best solution example.

If you have been asked to find a solution for two sum problem in Java on the technical interview, so you need to follow the following steps. Here are several moments you should keep in mind. First of all, you should know that we will use a map collection to hold temporary values. Second, the […]

November 6, 2020

### Easily Check the string if is a palindrome or not (Java).

In case you want to check if the string is a palindrome, you should follow several steps. First of all, you have to transform the string into an array of chars. Then you need to set two pointers. The fundamental idea is to compare pointers’ chars. With the help of the “while loop,” we compare […]

November 5, 2020

### How to reverse an array list in Java.

If you want to reverse an array in Java, you should follow several steps. The general idea to set two pointers. The left pointer’s primary purpose is to start from the array’s left side and move to the center. The right pointer’s primary goal is to begin from the right side and move to the […]

November 3, 2020

### How to find the minimum value in the array list in Java

To find the minimum value in the array in Java, you should follow several steps. The basic idea to set the temporary variable that we will use to compare with each element in the list. By default, the minimum element should be the first element in the list. With the help of the loop, we […]

November 3, 2020

### How to resize an array list in Java.

To resize the array in Java, you should follow several steps. The basic idea to create an empty array list with the needed length. And copy all elements from the first array list to the second. Resize the array list in Java example. Step-by-step implementation.If you want to resize the array list, you have to […]

November 2, 2020

### How to remove an item from the Linked List in Java by key.

If you want to remove an item from the linked list in Java by key, you should follow several steps. The fundamental idea to do with the pointers: the front pointer and the back pointer. Set the minimum interval between them, which is one element. Move both of them with the help of the “while […]

November 2, 2020

### How to insert an item in the sorted Linked List in Java.

If you want to insert an item in the sorted linked list in Java, you should follow several steps. This solution works if we work with the sorted linked list. The fundamental idea to do with the pointers: the front pointer and the back pointer. Set the minimum interval between them, which is one element. […]

November 2, 2020

### How to remove duplicates from the sorted Linked List in Java.

If you want to remove duplicates from the sorted linked list in Java, you should follow several steps. This solution works only if the linked list is sorted. The fundamental idea is to start the while loop until the next element is null. Compare the current element with the next one. If the values are […]