All Questions
10 questions
5
votes
2
answers
486
views
LinkedList class implementation in Python
I was solving this problem for implementing LinkedList and ListNode classes, and Insert and <...
10
votes
1
answer
206
views
TDD approach for Advent of Code challenge: infinite spiral on a grid
I have started the Advent of Code 2017 to learn to use Python and Test Driven Development. I wrote a solution for Day 3, Part 2, and would like to hear some help.
Specifically:
Do I apply TDD ...
3
votes
1
answer
132
views
General unit tested solution to Project Euler Problem 8: Largest product in a series
Project Euler Problem 8
The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832.
...
7
votes
1
answer
151
views
Reddit mirror encryption challenge
While reviewing Encryption using a mirror field, I decided to write my own solution from scratch. The challenge, from Reddit's /r/dailyprogrammer, is to implement a monoalphabetic substitution cipher ...
8
votes
2
answers
342
views
Next number with the same sum of digits
I recently came across a email bot that would give you random problems to solve.
Here is the problem.
Please write a function in python which receives a natural decimal N-digit number (1 to 15 ...
2
votes
1
answer
1k
views
TDD: String Calculator Kata
String Calculator
Create a simple String calculator with a method int Add(string numbers).
The method can take 0, 1 or 2 numbers, and will return ...
3
votes
1
answer
679
views
Integer ID pool
I would really appreciate some feedback on the code I wrote to solve the following problem:
Design an IdManager.
IdManager manages a pool of integer ids. (from 1 to n). It should
provide api’...
0
votes
1
answer
3k
views
Locker puzzle in Python
(Game: locker puzzle) A school has 100 lockers and 100 students. All
lockers are closed on the first day of school. As the students enter,
the first student, denoted S1, opens every locker. Then ...
1
vote
2
answers
672
views
Counting length-2 substrings that are common to two strings at the same offset -- Python
I solved the CodingBat task:
Given 2 strings, a and b, return the number of the positions where they contain the same length 2 substring. So "xxcaazz" and "xxbaaz"
yields 3, since ...
4
votes
1
answer
659
views
Sum of numbers which are not sum of two abundant numbers
The following program is a solution to Project Euler Problem 23. That problem defines an abundant number to be one whose sum of proper divisors is greater than it, tells us that all integers at least ...