All Questions
306 questions
4
votes
0
answers
57
views
SHA1 Algorithm Implementation in Zig
I have implemented the SHA1 algorithm in Zig, as a learning exercise, to teach myself both Zig and the actual algorithm behind SHA1. Now the second part I think I understood well enough. The ...
9
votes
4
answers
2k
views
"Weird Algorithm" (Collatz) from CSES Problem Set
I had to solve the following problem:
Consider an algorithm that takes as input a positive integer n. If n is even, the algorithm divides it by two, and if n is odd, the algorithm multiplies it by ...
9
votes
3
answers
2k
views
Is set of integers closed under the operation of subtraction?
I was working on a problem, but my solution did not pass the time limit test.
Problem
Let's say a set of integers is closed under the operation of
subtraction if for two distinct elements of this set ...
4
votes
2
answers
162
views
Basic Linked List Implementation in JavaScript
Clarification of Intent
Recursion here is used on purpose for practice - note that iteration is preferred in this case (I'll be more clear about where my intentions are!)
Factory function was also ...
5
votes
3
answers
1k
views
Coding exercise to represent an integer as words using python
Context:
Convert a non-negative integer num to its English words representation.
Example 1:
Input: num = 123
Output: "One Hundred Twenty Three"
Example 2:
Input: num = 12345
Output: "...
7
votes
3
answers
208
views
Euler - Largest Palindrome Product in Java
Having been going over the documentation, learning more of the subtleties of Java. I am now going over some basic Project-Euler solution code I wrote a little while back. Hoping I can pick up some ...
1
vote
0
answers
112
views
Rust implementation of a BTree
I'm studying rust, and I decided to implement a BTree as a way of learning the language.
Can anyone give me suggestions on the code?
As the language has no inheritance, and we must replace it with ...
2
votes
1
answer
37
views
Simplify matching values while comparing two sorted sets
This is in Star Basic but most likely quite a few languages would have similar structure.
I am comparing rows in two sorted sheets. I have a comparison function which returns -1 / 0 / 1 similarly to <...
8
votes
3
answers
2k
views
Sieve of Eratosthenes in C++ with wheel factorization
I have written a completely working C++ program for the first time, and I have managed to compile it. I have decided to learn C++ and I have written a C++ program to familiarize myself with C++, this ...
2
votes
1
answer
671
views
Find all permutations of string using recursion
Background: I am somewhat new to programming and only two weeks into learning Python. Currently trying to improve my understanding of recursion, which has been a tough concept for me to implement.
...
3
votes
1
answer
163
views
String Permutation Implemention
The objective is simple: List all possible permutations for a given a String. I looked at some implementations from popular sources. I decided to build this to the flow:
The Code for Review
...
0
votes
1
answer
175
views
Bookstore program using standard algorithms
This is the exercise, from C++ Primer 5th edition:
10.32: Rewrite the bookstore problem from § 1.6 (p. 24) using a vector to hold the transactions and various algorithms to do the
processing. Use <...
0
votes
1
answer
188
views
Getting three numbers input interactively and process them
I'm new to Python and programming in general.
Let's imagine I have a simple task:
Given 3 numbers from user input, I need to count negative ones and print the result.
Considering what I know about ...
0
votes
1
answer
416
views
subsets in array. Algorithm (No Linq)
Task:
A subset is a continuous segment of an array.
Two integer arrays are given with elements from 1 to 100: of N and n (N > n).
For every subset of the first array of n length find out the next ...
1
vote
2
answers
116
views
Object-Oriented Blackjack V2
[Edited] formatting and Flake8 linter corrections
Four days ago I posted my first object oriented programming project.
Everything I have learned to date is self-taught and posting project to receive ...