Skip to main content

Questions tagged [scala]

Scala is a general purpose programming language principally targeting the Java Virtual Machine. Designed to express common programming patterns in a concise, elegant, and type-safe way, it fuses both imperative and functional programming styles.

1 vote
0 answers
71 views

LeetCode 399 Evaluate Division using Scala

In order to gain familiarity with Scala I am trying to solve the following problem https://leetcode.com/problems/evaluate-division/description/ You are given an array of variable pairs equations and ...
ThePunisher's user avatar
4 votes
7 answers
265 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
  • 385
2 votes
1 answer
79 views

Tic Tac Toe on the command line in Scala

This is my first Scala program, so I'd appreciate any feedback but especially feedback specific to Scala, for example situations where I could have utilised a feature better or where I've done ...
L68967gy's user avatar
1 vote
0 answers
84 views

Scala & Kafka: Getting the producer and consumer offset difference and log it

I'm looking to compare kafka's producer and consumer ...
sojim2's user avatar
  • 111
3 votes
1 answer
98 views

Batching method implementation - Scala

I need to implement a function/method that operates on a sequence of values, and acts kind of like takeWhile, but with 2 differences, first, it doesn't act on a single element, it is performed on a ...
AminMal's user avatar
  • 133
1 vote
1 answer
709 views

Get tennis game's state using scala

I am developing a scala function called TennisGameStatus which returns the state of tennis games between two players. To remind, here are the rules of tennis games :...
Imed 's user avatar
  • 11
1 vote
0 answers
37 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
1 vote
2 answers
72 views

Extracting items from comma/semicolon-delimited strings, discarding parts after a hyphen

New Scala dev here. Is there a more idiomatic or efficient way to accomplish this in Scala? Given a list of the following strings, I need to obtain the unique 'main parts' once any parts including ...
Jonathan Spiller's user avatar
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
113 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
  • 539
1 vote
1 answer
84 views

Checking whether a graph is connected in an immutable way

I have this function at the moment ...
bigfocalchord's user avatar
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
2 votes
0 answers
130 views

Scala 3 Typeclass derivation using low-level mechanisms: The `Eq`-example

I've been playing around with this example from the Scala 3 documentation, and I noticed that certain things duplicate functionality already present in the standard API; In particular, the ...
Andrey Tyukin's user avatar
3 votes
1 answer
313 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
4 votes
1 answer
157 views

Improving Mancala Game

https://www.mastersofgames.com/rules/mancala-rules.htm I am trying to create a working Mancala Game in scala, Currently, I have 3 classes, Board, ...
Dahiben Kumar's user avatar

15 30 50 per page
1
2 3 4 5
34