All Questions
Tagged with functional-programming interview-questions
17 questions
1
vote
1
answer
126
views
Simple Curry function
This is a interview practice question from BFE.dev.
Currying is a useful technique used in JavaScript applications.
Please implement a curry() function, which ...
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 ...
8
votes
2
answers
409
views
Function invocation every second time
Recently I got test task at the project, it is fairly simple:
...
1
vote
2
answers
334
views
Count Substrings for a binary string
Problem is taken from leet code.
Give a string s, count the number of non-empty (contiguous) substrings that have the same number of 0's and 1's, and all the 0's and all the 1's in these substrings ...
2
votes
0
answers
319
views
KMP algorithm in scala
I implemented KMP pattern matching algorithm in Scala. My code works but it looks more imperative and a scala translation of C/C++ implementation.
I am not able to figure out how to manage multiple ...
1
vote
1
answer
121
views
Find first repeating Char in String
Given a string, find the first repeating character in it.
Examples:
firstUnique("Vikrant") → None
...
0
votes
2
answers
65
views
Expand spreadsheet ranges to lists of cells in Scala
Problem
Spreadsheet cells are referenced by column and row identifiers. Columns are labeled with alphabetical characters, starting with "A", "B", "C", ...; rows are numbered from 1 in ascending ...
4
votes
2
answers
450
views
Replace array element with multiplication of neighbors in Scala
Given an array of integers, update the index with multiplication of previous and next integers,
Input: 2 , 3, 4, 5, 6
Output: 2*3, 2*4, 3*5, 4*6, 5*6
Following ...
1
vote
1
answer
788
views
Clockwise rotate a matrix in Scala
Given a matrix, clockwise rotate elements in it.
Examples:
...
1
vote
2
answers
509
views
Print matrix in spiral order in Scala
Problem:
Given a square or rectangular matrix, print its element in spiral
order.
For example, if input matrix is this:
...
0
votes
1
answer
531
views
Print words in decreasing order of frequency in Scala
Given a string print its words in decreasing order of frequency.
Example:
i/p - "aa bbb ccc aa ddd aa ccc"
o/p - aa,ccc,ddd,bbb
Scala:
...
2
votes
3
answers
408
views
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 ...
1
vote
1
answer
912
views
Calculate simple arithmetic string in Scala
Problem
Given an arithmetic string like 2+2*3 calculate result 8.
Assumptions you can make
string will be always well formed (no error checking needs to be done)
only operators passed in string ...
0
votes
1
answer
385
views
find if one string is a valid anagram of another , in scala
Question is taken from leet code.
Problem
Given two strings s and t , write a function to determine if t is an anagram of s.
Examples
...
4
votes
1
answer
929
views
Longest Substring Without Repeating Characters in Scala
Question is taken from Leetcode and solution works for their test cases. I do see a scope of improvement and make it more functional (getting rid of vars and mutables data structures). Please suggest ...