Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
1 answer
109 views

Finding the number of distinct decompositions a number has using only repdigits

This is a problem from a previous semester that I am trying to upsolve. I am trying to solve a problem involving the total number of ways of decomposing a number using only repdigits. A repdigit is a ...
Lesserrafim's user avatar
7 votes
2 answers
1k views

Find all combinations of length 3 whose sum is divisible by a given number

I came up with a suitable solution to a HackerRank problem that failed because the execution took longer than 10 seconds on lists that were of very large size. The problem: Given a list ...
NFeruch - FreePalestine's user avatar
8 votes
3 answers
326 views

Refactor the code which performs "cross-product", "reduce", "product of list" and "sum of list"

I have come up with a sequence of steps to find the maximum product of y positive numbers which add up to x. But the program is ...
Yozachar's user avatar
  • 227
2 votes
2 answers
575 views

Counting block combinations I: Project Euler 114

Problem statement (For more detailed description (including pictures), please, visit the link): A row measuring seven units in length has red blocks with a minimum length of three units placed on ...
Stokolos Ilya's user avatar
4 votes
1 answer
655 views

Counting Bouncy Numbers: Project Euler #113

Problem statement: Working from left-to-right if no digit is exceeded by the digit to its left it is called an increasing number; for example, 134468. Similarly if no digit is exceeded by the ...
Stokolos Ilya's user avatar
2 votes
3 answers
3k views

Counting numbers that are divisible by 3 and can be produced from the digits of a given number

I'm trying to solve this problem from codewars. Problem Given a certain number, how many multiples of three could you obtain with its digits? Suppose that you have the number ...
tarit goswami's user avatar
2 votes
2 answers
986 views

Project Euler # 24 Lexicographic permutations in Python

A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we ...
user avatar
4 votes
2 answers
772 views

Letter case permutation

The question can be found here https://leetcode.com/problems/letter-case-permutation Given a string S, we can transform every letter individually to be lowercase or uppercase to create another ...
user avatar
2 votes
2 answers
2k views

Staircase challenge - Python

Your task is to print all unique ways to climb a staircase of length n where, from each step, you can take steps of size x where ...
MrJoe's user avatar
  • 2,143
5 votes
1 answer
2k views

Project Euler 76: Counting summations

Project Euler Problem 76 asks: How many different ways can one hundred be written as a sum of at least two positive integers? My code is correct but just works slowly. ...
camarman's user avatar
  • 519
1 vote
2 answers
924 views

Lattice path from Project Euler with Python solution

I was trying to solve this problem called lattice path from Project Euler: Count the number of unique paths to travel from the top left to the bottom right of a lattice of squares. How many such ...
NinjaG's user avatar
  • 2,559
10 votes
3 answers
726 views

Master Locksmith

Description Master Locksmith has just finished the work of his life: a combination lock so big and complex that no one will ever open it without knowing the right combination. He's done testing ...
Ludisposed's user avatar
  • 11.8k
2 votes
1 answer
96 views

Total of maximum values in all subarrays

This is the crux of a problem found on one of those code challenge sites. I'm fairly new to programming and this was a difficult challenge. I've attempted to solve this with stacks and calculating ...
Paul K's user avatar
  • 373
3 votes
2 answers
2k views

Maximum sub-array of non-negative numbers

This is the "Maximum sub-array" problem from CodeChef: Find out the maximum sub-array of non negative numbers from an array. The sub-array should be continuous. That is, a sub-array created ...
Latika Agarwal's user avatar
8 votes
2 answers
1k views

Python solution to Code Jam's 'Rounding Error'

The "Rounding Error" problem of Round 1B of Google Code Jam 2018 is as follows: Problem To finally settle the age-old question of which programming language is the best, you are asking a total ...
Eugene Yarmash's user avatar

15 30 50 per page