All Questions
7 questions
1vote
1answer
310views
Provide functional-programming style solution for 2D Array - DS challenge
Problem Statement: Given a 6×6 2D Array, arr: 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 We define an hourglass in A to be a subset of ...
5votes
2answers
308views
Counting valleys traversed below sea level, given elevation changes
Problem Statement: Gary is an avid hiker. He tracks his hikes meticulously, paying close attention to small details like topography. During his last hike he took exactly steps. For every step he ...
2votes
3answers
408views
List of Happy Numbers in scala
Definition of Happy numbers taken from Wikipedia. A happy number is defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits ...
2votes
1answer
95views
Project Euler 23 in Scala (non-abundant sums)
I recently overhauled my solution to Project Euler Problem 23 (which asks for the sum of all positive integers which cannot be written as the sum of two abundant numbers) to move it from an imperative ...
9votes
1answer
604views
Kattis problem Amanda Lounges
I wrote this solution to Kattis problem Amanda Lounges in Scala. The code is written to solve a graph theory problem where it will read in a list of edges from stdin and try to compute the minimum ...
2votes
1answer
142views
Project Euler 4 The Functional Way
I'm learning Scala (and functional programming). Is there a better way to solve Euler problem 4 than either of these two solutions. Euler 4 I like this array comprehension solution, but it wastes so ...
4votes
2answers
132views
Timing Project Euler Problem 1
Is there a better way to time the functions and print the result and function name dynamically? ...