Skip to main content

All Questions

Filter by
Sorted by
Tagged with
3 votes
2 answers
185 views

Map coloring algorithm functional implementation in python

I'm an autodidact working on map coloring algorithms with backtracking, see chapter 2 of this book. I tested this implementation with success but I'm still unsure whether it is tricking me somewhere, ...
deppep's user avatar
  • 33
2 votes
1 answer
110 views

Move timestamp to the next Monday 10:01 AM [closed]

I've been battling ChatGPT for hours now and can't get satisfied with this simple algorithm in TypeScript. These two (hopefully correct) TypeScript+ReactNative solutions should move the timestamp ...
Slazer's user avatar
  • 121
3 votes
1 answer
135 views

Recursive Factorial Calculation in JavaScript

...
TAHER El Mehdi's user avatar
1 vote
2 answers
627 views

Removing Elements from an Array Based on a Second Array

I've written a function that takes two arrays of integers as input and removes all the elements in the first array that are also present in the second array. I would like to share my code with you and ...
TAHER El Mehdi's user avatar
1 vote
1 answer
62 views

Optimizing the Dig Pow function

I have written a Python function to solve the Dig Pow problem, where the goal is to find a number k such that the sum of each digit of n raised to a specific and ...
TAHER El Mehdi's user avatar
7 votes
5 answers
1k views

Optimizing a function to find the closest multiple of 10

I have written a Python function called closest_multiple_10() which takes an integer as input and returns the closest multiple of 10. The function works as expected,...
TAHER El Mehdi's user avatar
4 votes
7 answers
305 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
2 votes
1 answer
143 views

Project Euler 11 Haskell - Largest product in a grid

Intro I have been learning haskell and functional programming using random Project Euler problems. Currently, I have solved Problem 11. What is the greatest product of four adjacent numbers in the ...
Naitik Mundra's user avatar
1 vote
1 answer
832 views

Functional Fibonacci in OCaml

I'm very new to OCaml, and as an exercise I decided to implement the nth Fibonacci algorithm (return a specific Fibonacci number, given an index) in different ways, using what I've learned so far. I ...
NPN328's user avatar
  • 771
2 votes
3 answers
129 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
4 votes
3 answers
2k views

Split function using C and dynamic memory allocation

I have programmed a function to split strings, and it gives the expected output. I am looking forward to write better code and I was told here is a good place to start. Here's my program: ...
Majd's user avatar
  • 141
2 votes
1 answer
131 views

Projecteuler.net Problem 2 using collection pipeline Pattern

I solve projecteuler.net Problem 2 deferent way Generate number from 1 to range ex 100 and get the even number Get Fibonacci numbers from list Reduce array I have one problem with a large set of ...
NinjaDeveloper's user avatar
3 votes
2 answers
5k views

Hackerrank problem: Climbing the Leaderboard (Java)

I am solving the following Hackerrank problem: Climbing the Leaderboard. The problem statement: Alice is playing an arcade game and wants to climb to the top of the leaderboard and wants to track her ...
Mughees Asif's user avatar
3 votes
1 answer
228 views

C++ algorithm to implement multiple operators in one

I have a class called IntMatrix which has 2 fields: ...
user225756's user avatar
2 votes
1 answer
91 views

naive bayes sentiment analysis classifier in clojure

attaching my try on implementing simple naive-bayes classifier for sentiment analysis as part of learning clojure and using functional programming on ML algorithms. I tried to invest more time in ...
a.k's user avatar
  • 151

15 30 50 per page
1
2 3 4 5 6