All Questions
Tagged with java programming-challenge
635
questions
3
votes
1
answer
204
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 ...
9
votes
2
answers
559
views
Advent of code 2023 day 5 in Java: mapping integer ranges to new integer ranges
Context
I'll be passing an interview coding test in java soon. I am experienced with other programming languages but am very unfamiliar with Java. I am looking for critiques of the coding style much ...
5
votes
1
answer
327
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 ...
4
votes
2
answers
488
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 ...
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 ...
1
vote
0
answers
14
views
Determine top t values with few calls to order(), a given procedure to order k values, Java take 2
My 2nd take of the problem in Determine top t values with few calls to order(), a given procedure to order k values:
Given an array and a procedure to order \$k\$ ...
4
votes
4
answers
180
views
Determine top t values with few calls to order(), a given procedure to order k values
I tried to write a decent answer to Most efficient way to get the largest 3 elements of an array using no comparisons but a procedure for ordering 5 elements descendantly.
I could not come up with ...
-1
votes
1
answer
294
views
HackerRank "Digit sum" challenge
Here's the question:
...
2
votes
3
answers
543
views
Recursive palindrome check
I'm trying to solve this which basically calls for a recursive palindrome check with some minor extra steps (Special characters and whitespace can be ignored). The test inputs' length can be 100000 ...
2
votes
1
answer
175
views
An evolutionary algorithm written in Java to crack an XOR cipher
Alright. So TryHackme is a website that tries to teach hacking with hands on labs. They have a room called JVM Reverse Engineering where the user gets to reverse engineer Java apps, and in particular ...
1
vote
2
answers
397
views
Coin Change in Java
Inspired by a leetcode exercise, I wrote my own coin changer:
You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of ...
4
votes
2
answers
95
views
Partition List in 2 parts
I came up with the following code while trying to solve the Leetcode partition list problem
Though my solution is accepted, I am not happy with a few of the additional variables which I am creating. ...
4
votes
3
answers
4k
views
Split word based on terms from an array
I was faced with a coding challenge and I'm looking for a more elegant way to achieve the goal.
The challenge
Take the word baseball from the first item in the string
array and split it into two ...
3
votes
1
answer
460
views
Codewars - How many pages in a book?
Problem Statement
Every book has n pages with 1 to n pages. The summary is made by adding ...
3
votes
1
answer
266
views
Highly divisible triangular number
Highly divisible triangular number, my solution
My solution of challenge from Project Euler takes too much time to execute. Although on lower numbers it works fine. Anyone could look up to my code and ...