All Questions
14 questions
5
votes
2
answers
673
views
Project Euler #23 Non-abundant sums
I'm having trouble optimizing the Project Euler problem number 23 :
A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the ...
5
votes
2
answers
6k
views
Mars Rover Simulator
Problem Statement
Consider a rover and a plateau of size nxn. The rover takes three type of instructions L,R and M. 'L' and 'R' rotate the rover in the left and right direction. 'M' moves the ...
4
votes
3
answers
2k
views
Count words in a string
Continuing my TDD from exercism.
Write a program that given a phrase can count the occurrences of each word in that phrase.
For example for the input ...
4
votes
3
answers
2k
views
Binary string to decimal conversion
Problem Statement:
Write a program that will convert a binary number, represented as a
string (e.g. '101010'), to its decimal equivalent using first
principles
Implement binary to decimal ...
4
votes
2
answers
1k
views
Let's play Scrabble
Problem:
Write a program that, given a word, computes the scrabble score for
that word.
Code:
...
4
votes
0
answers
105
views
Writing Go object code that respects Go guidelines
I'm learning Go and I wrote this for a programming challenge. It is working (building and running) but I feel the code is not what Go code should be:
Am I using the ...
3
votes
1
answer
91
views
(Follow-up) Project Euler #11 Largest Product in a Grid | Cache-optimized + sliding window (C++14)
Original code review: Project Euler #11 Largest Product in a Grid | Cache-optimized + sliding window (C++14)
Source: HackerRank & ProjectEuler.net
Problem: Largest Product in a Grid
In the 20×...
2
votes
1
answer
601
views
Jesse and Cookies
Jesse loves cookies. He wants the sweetness of all his cookies to be greater than value K. To do this, Jesse repeatedly mixes two cookies with the least sweetness. ...
2
votes
2
answers
148
views
Project Euler #11 Largest Product in a Grid | Cache-optimized + sliding window (C++14)
Source: HackerRank & ProjectEuler.net
Problem: Largest Product in a Grid
In the 20×20 grid below, four numbers along a diagonal line have been marked in red.
...
2
votes
1
answer
872
views
Raindrops in Java
Problem Statement:
Write a program that converts a number to a string, the contents of
which depends on the number's prime factors.
If the number contains 3 as a prime factor, output '...
2
votes
2
answers
4k
views
Designing a book library
Description:
Design a book library which maintains the book inventory.
The library should allow an user to favorite/un-favorite
book. The library should allow an user to rent a book for
a given ...
1
vote
1
answer
205
views
Rock paper scissors coding assignment
I had a coding assignment to write a Rock Paper Scissors game. The main task is not to show a solution but rather to test the coding style. The rules are such:
Problem:
rock is "O", paper is ...
0
votes
1
answer
380
views
Python program to find the substring with concatenation of all words
This is a Leetcode problem:
You are given a string, S, and a list of words, L that are all of the same lengths. Find all starting indices of substring(s) in S that is a concatenation of each word ...
0
votes
1
answer
250
views
Python Logic Gate Circuit Simulator [closed]
I have recently become interested in simulating logic circuits because of a electronics class at school. I have created a functioning simulator for logic gate circuits in Python. My implementation ...