Skip to main content

All Questions

Filter by
Sorted by
Tagged with
5 votes
1 answer
304 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
  • 301
4 votes
2 answers
462 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
  • 301
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
  • 301
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\$ ...
greybeard's user avatar
  • 6,416
4 votes
4 answers
179 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 ...
greybeard's user avatar
  • 6,416
-1 votes
1 answer
256 views

HackerRank "Digit sum" challenge

Here's the question: ...
The Infinite Star's user avatar
2 votes
3 answers
539 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 ...
Yamin's user avatar
  • 125
2 votes
1 answer
173 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 ...
Aleksey's user avatar
  • 173
1 vote
2 answers
391 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 ...
Martin Frank's user avatar
  • 2,838
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. ...
Bagira's user avatar
  • 171
4 votes
3 answers
3k 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 ...
codejunkie's user avatar
3 votes
1 answer
456 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 ...
HariHaravelan's user avatar
3 votes
1 answer
255 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 ...
Hubert's user avatar
  • 31
4 votes
2 answers
763 views

Coding exercise to implement IsApproximatelyEqual in Java

this assignment was given to me within the job application process (well, really not much infos given): for our applikation we have to compare very often floating point numbers (double, float). Can ...
Martin Frank's user avatar
  • 2,838
3 votes
1 answer
524 views

Finding the minimum element of a stack of numbers

As part of an online programming challenge, I wrote a program that implements a stack of integers, supporting adding and removing elements, finding the last inserted element, and the minimum element. ...
gparyani's user avatar
  • 131

15 30 50 per page
1
2 3 4 5
43