Skip to main content

All Questions

2 votes
3 answers
553 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 Siahmargooei's user avatar
6 votes
3 answers
2k views

Money change exam

I was asked to create a method that would: Return a Change object or null if there was no possible change The "machine" has unlimited bills of: 2, 5 and 10 The Change object must return the ...
Esteban Rincon's user avatar
5 votes
1 answer
261 views

Drawing a Thue-Morse pattern recursively

This is web exercise 3.1.63. from the book Computer Science An Interdisciplinary Approach by Sedgewick & Wayne: Write a program that reads in a command line input N and plots the N-by-N Thue-...
Khashayar Baghizadeh's user avatar
5 votes
2 answers
493 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
1 answer
557 views

Speeding up a recursive Cantor pairing function

The Cantor Pairing function is a mathematical function which takes two integers and combines them into a single integer that is unique to that pair. This single integer can later be "unpaired" back ...
HomeworkHopper's user avatar
2 votes
2 answers
152 views

"Smart" sudoku brute-forcer

After running my C-brute-forcer for two days on a 25x25 sudoku, I decided to re-write in Java so that it would solve it in an acceptable time frame. The idea: Make smart fields that contain all ...
mindoverflow's user avatar
1 vote
1 answer
439 views

Rectangle packing in smallest possible area

I have written a Java Program to place a bunch of rectangles into the smallest possible rectangluar area(no overlapping and rotating). Here is a short summary: I calculate minArea and maxArea: ...
Marten's user avatar
  • 595
4 votes
3 answers
1k views

Java Magic square program

Here is my improved version of my Magic square program from following this earlier version. I also added a few comments. Any help for improvements would be really appreciated. ...
Marten's user avatar
  • 595
3 votes
1 answer
661 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
  • 595
1 vote
1 answer
496 views

Counting contiguous subarrays with a negative sum

I'm doing a coding challenge that asks to count the number of contiguous subarrays that have a negative sum: A subarray of an n-element array is an array composed from a contiguous block of the ...
Richard's user avatar
  • 171
1 vote
4 answers
2k views

Improving Fibonacci recursion with BigIntegers

I've been tasked with making a fast Fibonacci recursive method that uses BigInteger to calculate REALLY big numbers. However, to calculate numbers past 30 it takes ...
Ozymandias's user avatar
2 votes
2 answers
3k views

All possible groups of combinations of array

Let's assume I have a one-dimensional array of integers of size n. My problem is to generate all the combination of all possible groups of size 1 to n, such as each combination has exactly one ...
bill0ute's user avatar
  • 121
6 votes
2 answers
20k views

Find all words in a dictionary that can be made with a string of characters (Recursion/Binary Search)

I'm working on an algorithm that could take in a string of 20 random characters, and display to the user every word in a dictionary that can be successfully made with those letters, regardless of ...
Black Diamond's user avatar
4 votes
1 answer
2k views

Pizza ordering program recursion on the GUI

This program is a basic pizza ordering program with seven topping options, four size options, and five crust options. It pulls the options from a database and populates the GUI on start. I connected ...
Allie Marie's user avatar
3 votes
2 answers
342 views

Java exhaustive solution

This is a take on Pebble Solitaire. The user inputs n number of games and after that inputs a strings of length 23 that contains a combinations of only 'o' (pebble) and '-' (empty space). If there are ...
Keith's user avatar
  • 31

15 30 50 per page