Skip to main content

All Questions

Tagged with
2 votes
2 answers
63 views

A thread-safe performant Money Transfer API in Java

This is a popular interview question. It is meant to be done within 30 minutes. The task is to implement a thread-safe performant Bank Account API that allows to transfer, deposit, withdraw and check ...
Sasha Shpota's user avatar
3 votes
1 answer
217 views

Leetcode: Number of Islands - BFS (Queue vs Recursion)

I was playing around with leetcode's Number of Islands. As per the challenge's description: Given an m x n 2D binary grid grid which represents a map of '1's (land) and '0's (water), return the ...
ccot's user avatar
  • 341
5 votes
1 answer
121 views

Creating random music covers using Conways Game of Life algorithm

(A sample cover art follows.) I'm currently working on replacing all the covers of my music files to have a unified theme, and I've started this project in Java to refresh my knowledge after a gap of ...
Zipity's user avatar
  • 51
5 votes
1 answer
332 views

Leetcode: Largest Number

I was trying out leetcode's Largest Number. As per the challenge's description: Given a list of non-negative integers nums, arrange them such that they form the largest number and return it. Since ...
ccot's user avatar
  • 341
4 votes
2 answers
492 views

Leetcode: Steps to Make Array Non-decreasing

I was trying out leetcode's Steps to Make Array Non-decreasing As per the challenge's description: You are given a 0-indexed integer array nums. In one step, remove all elements nums[i] where nums[i ...
ccot's user avatar
  • 341
9 votes
4 answers
2k views

Leetcode : First Missing Positive

I was trying out leetcode's first missing positive. As per the challenge's description: Given an unsorted integer array nums, return the smallest missing positive integer. You must implement an ...
ccot's user avatar
  • 341
1 vote
1 answer
368 views

Inserting large number of rows into database with Spring boot

I need to insert many million rows + many GB of data into a database for a project that uses Spring boot. I recreated a minimal example with a one to many relationship and am trying to find the ...
Pux's user avatar
  • 155
6 votes
3 answers
698 views

Program that brute forces to find the minimum dominating set

This program solves the minimum dominating set but it takes an insanely long time to run. In case you do not know, in graph theory, a dominating set for a graph G is a subset D of its vertices, such ...
BeginnerProgrammer6's user avatar
4 votes
2 answers
427 views

Map constructor utility class in Java 8

In a Java 8 project, I'm using several maps, many of which contain static or default content. In Java 9 and newer, there's the convenient Map.of() method and I want ...
Green绿色's user avatar
2 votes
4 answers
177 views

Comparison of two excel files ignoring line order

Below is a simple method which compares contents of two excel files ignoring the line order. This method is working as expected. But, one of my peers in their code review mentioned that initializing ...
AutoTester999's user avatar
2 votes
1 answer
78 views

Implementing an improved merge sort that uses insertion sort, with "levels" - Would this work correctly?

We were asked to improve the merge sort algorithm by introducing insertion sort to the code. We have been tasked with doing this by utilising a "levels" logic. Here is the exact description ...
Preatorius's user avatar
6 votes
1 answer
125 views

One or more planets to line up with the earth a certain amount of times

I have attempted the below question, however my solution is too slow (i.e. It does not fit the 2 second time constrain for java). How can the solution be optimised? While at IOI 2020 in Singapore, ...
Zareef Akoodie's user avatar
3 votes
1 answer
93 views

Performance of this BCrypt lossless compressor

The following code compresses a 60-byte BCrypt MCF into 40 bytes. Does anyone see room for performance or other optimizations? For example, I should replace Guava's ...
Oliver's user avatar
  • 93
0 votes
4 answers
119 views

Code counts the number of identical elements between the arrays 's' and 'd' at the same index

I wrote a code and the code counts the number of identical elements between the arrays s and d at the same index. I need to ...
Rustam Abdiyev's user avatar
1 vote
0 answers
73 views

A parallel MSD radix sort in Java for integer keys

I have this repository: https://github.com/coderodde/ParallelRadixSort.java/tree/main It contains a parallel MSD radix sort presented below: ...
coderodde's user avatar
  • 28.8k

15 30 50 per page
1
2 3 4 5
86