Skip to main content

All Questions

4 votes
7 answers
279 views

Breaking a string expression in operator and operands

Requesting for a code review for a scala implementation. Problem Given an expression string made of numbers and operators +,-,/,* , break it in a list of Integer or ...
vikrant's user avatar
  • 405
1 vote
0 answers
40 views

Relational join of two datasets

Front Matter I'm learning Scala and have not gotten used to functional programming and the language. I'm hoping a review of my naively implemented code can help me bridge my object-oriented ways to ...
Zhao Li's user avatar
  • 111
3 votes
2 answers
1k views

Scala Parentheses Balancing in Functional Programming

I was working on the problem to check if the parenthesis are balanced using Scala. Examples: balance("(Hello (my) name is (StackOverflow))") -> ...
Julian Espinel's user avatar
2 votes
0 answers
116 views

Deserialize a binary tree breadth-first in functional programming

A while back, I answered this question on Stack Overflow that involved deserializing a binary tree breadth-first using functional programming (the question itself isn't relevant). I'd like to make ...
user's user avatar
  • 529
2 votes
3 answers
124 views

Is My Function to Find Triplets in Scala running in O(N^2)

Given the classical problem to find triplets that sum to zero in an array. Is my Scala implementation correct and executed in O(N^2)? If yes, why? Can someone make a running time analysis. What other ...
Filipe Miranda's user avatar
3 votes
1 answer
319 views

Efficiently calculate value of Pascal's Triangle using memoization and recursion

So reading about functional programming, applications to dynamic programming, and learning Scala. I figured I would try it out with a popular example, Pascal's Triangle, tests against known values ...
Martin Boros's user avatar
6 votes
2 answers
574 views

Improving my Tic Tac Toe Solution in Scala

I'm relatively new to Scala and made a small TicTacToe in a functional Style. Any improvement options would be highly appreciated. There are some things which I am unsure of if they are made in an ...
elauser's user avatar
  • 179
3 votes
1 answer
230 views

Improvements, TicTacToe in Scala

I've just started my journey into functional programming and tried to implement a TicTacToe game Recursively without State in Scala. What I dislike is the JOptionPane but I don't know if i can solve ...
elauser's user avatar
  • 179
3 votes
1 answer
70 views

Scala: Cumulative String Tokenisation

I'm trying to split an incoming stream of strings into cumulative tokens per line item using a function below, ...
Wiki_91's user avatar
  • 43
2 votes
0 answers
187 views

generic implementation approaches for a recursive function

Let's take the famous fibonacci problem as an example but this is a generic problem. Also, taking scala as the language as it's rather feature-rich. I want to know which solution you'd prefer. we all ...
Maths noob's user avatar
2 votes
0 answers
60 views

Finite automaton library in Scala including subset construction and minimization

I built a scanner generator like flex or jflex in Scala for a class last year. Part of this project is a small library for handling and manipulating finite automata. It works completely as intended, ...
LukeG's user avatar
  • 173
-1 votes
1 answer
59 views

Functional filter unique elements in sequence is not as good as imperative [closed]

Can you please help me fulfill the following? Requirements: Create an iterable with unique elements. Their order should be preserved: a | b | a | c → a | b | c ...
user214187's user avatar
1 vote
1 answer
310 views

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 ...
Sandio's user avatar
  • 109
3 votes
2 answers
401 views

Count character 'a' in first n characters of indefinitely repeating string s

Problem statement: Lilah has a string, s, of lowercase English letters that she repeated infinitely many times. Given an integer, n, find and print the number of letter a's in the first n ...
Sandio's user avatar
  • 109
5 votes
2 answers
308 views

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 ...
Sandio's user avatar
  • 109

15 30 50 per page
1
2 3 4 5
7