Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Tagged with
Filter by
Sorted by
Tagged with
5 votes
1 answer
112 views

How to merge two descending singly linkedlist into one ascending linkedlist using Recursion without any helper method?

Here is my solution: I want to know if my solution fits the requirement 100%? Or if there is any better solution? Constraint of the question: must be singly linkedlist must use recursion, and no ...
Ziyu Zhong's user avatar
4 votes
1 answer
305 views

Minimax based Tic Tac Toe

I am attempting to make an unbeatable Tic Tac Toe game using a simplified minimax algorithm. The code looks like this: ...
qwerty's user avatar
  • 361
5 votes
2 answers
520 views

How to optimize Karatsuba algorithm (using arraylist and java)

I was using Karatsuba algorithm to multiply two polynomials and return the coefficients and I am using java, we are asked to use arraylists here, however, my code is too complicated and it takes much ...
Jenny's user avatar
  • 51
2 votes
0 answers
93 views

Kadanes algorithm implementation

I just wanted to ask the following question. I have solved Kadanes algorithm using the recursive approach as shown below. The implementation works ...
log N's user avatar
  • 121
5 votes
0 answers
1k views

Mahjong hand completeness checking algorithm

As a summer project, I have been working on a small-scale, console-based version of Mahjong (the Rummy-like hand completion game, and not the solitaire version). While having prior knowledge of the ...
Joey Hunt's user avatar
9 votes
4 answers
3k views

"What is the maximum that Player 1 can win?"

This is a question that I encountered in one of the competitive coding tests. The question goes as follows: A 2-player game is being played. There is a single pile of stones. Every stone has an ...
User_Targaryen's user avatar
5 votes
2 answers
318 views

Three stage Sudoku puzzle generator

This was my first time attempting a project like this, so I figured it would improve readability, and would also just be nice If I allowed each stage to be visualized. Also, this only generates them, ...
Kestrel_'s user avatar
  • 171
3 votes
2 answers
1k views

Counting the number of ways to decode a string

I am working on problem where I need to decode a string: A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... '...
user5447339's user avatar
3 votes
2 answers
593 views

Find the longest sub string of a word after concatenation of given words array

An Array of N words is given. Each word consists of small letters ('a'-'z'). Our goal is to concatenate the words in such a way as to obtain a single word with longest possible substring composed of ...
Ora2gaurav's user avatar
3 votes
1 answer
684 views

Speed up Magic square program

I have written a Java program to calculate magic squares with recursion and backtracking. A 3*3 Magic square is calculated in about 1 sec, but a 4*4 needs about 50 minutes on my laptop with Intel i5. ...
Marten's user avatar
  • 605
3 votes
1 answer
676 views

Checking whether given array is sorted by divide-and-conquer

I've written a code that I try to use divide and conquer approach to determine if the given array is sorted. I wonder whether I apply the approach accurately. ...
Soner from The Ottoman Empire's user avatar
1 vote
2 answers
772 views

Find all root to leaf paths in binary tree

Description: Given a binary tree, return all root-to-leaf paths. Leetcode ...
CodeYogi's user avatar
  • 5,177
2 votes
1 answer
524 views

Find minimum depth in a binary tree

Description: Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. Note: A leaf is a node ...
CodeYogi's user avatar
  • 5,177
0 votes
2 answers
373 views

Binary search for integers

I've written binary search with only my own efforts 💪💪 without glancing at anywhere. I stuck on finding base case. At final, I think that if last checking is less than first index or first checking ...
Soner from The Ottoman Empire's user avatar
1 vote
1 answer
500 views

Reinterpreting a string, treating < as a backspace character

I've come up with a solution to this coding challenge using recursion. In summary, the input is a string where the < symbol represents a backspace (up to 1 ...
Archie Gertsman's user avatar

15 30 50 per page