# All Questions

67,155 questions
Filter by
Sorted by
Tagged with
106 views

### How to optimize bitwise get/set/clear of ranges of bits in JavaScript?

I have been working for a few days on writing get, set, and clear bitwise functions in ...
30 views

### Find lowest consecutive value

I have created a program where I first set the size of the array and how many times I will look for consecutive values, then I fill in the array and finally I insert the consecutive values, it should ...
5 views

### Do I need to use inheritance and classes for my OOP webscraper?

I am currently writing python code that scrapes information from the web. I have to scrape several sites, but there a two types of procedures: Directly scrape from the website Download pdf and scrape ...
14 views

### messages.php file security and efficiency

I am creating a social network and I want to know how secure and clean this code is. I had to update it to prepared statements because I was following a tutorial and even though it was made in 2019 it ...
6k views

### Project Euler problems 1 and 2 in python

What do you think about my code? I am a beginner and just started doing some algorithmic exercises to sharpen up my python skills. Here is code for problem #1: ...
38 views
+50

### HybridSort of QuickSort and MergeSort

I'll try to publish a paper about the programming language I've made (ArithmeticExpressionCompiler, short AEC) in Osječki Matematički List and, in order to demonstrate its usability for implementing ...
62 views

### Calculate radians from slope - comparing floats

I'm reviewing the following code - I'm a QA Engineer in the team that has written and is maintaining this code. https://github.com/itext/i7j-pdfsweep/blob/develop/src/main/java/com/itextpdf/pdfcleanup/...
7 views

### Chess game for my students

I teach programming, and I currently teach my class about inheritance, abstract classes, and mixins. I wrote this code as an example, and I want to be sure it is as good as possible before I release ...
76 views

### Find the maximum price change over any 1 to 5 day rolling window

The code below solves the following task Find the maximum price change over any 1 to 5 day rolling window, over a 1000 day period. To be clear "any 1 to 5 day rolling window" means ...
6 views

### Converting a graph to a directed graph with order of the nodes defined by post-order traversal

Background: I'm implementing an algorithm from the paper Polygon Area Decomposition for Multiple-Robot Workspace Division and one of the steps is to represent a polygon as a graph. This is done by ...
14 views

### LeetCode 273: Integer to English Words

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Convert a non-negative integer to its English words representation. ...
64 views

### Best way to store the sum of all node depths?

To sum up all the nodes' depths in any given binary tree, I've written the following recursive algorithm: ...
39 views

### Parallel image segmentation

Follow up question Image processing using Python OOP library I want to use multiprocessing to analyze several images in parallel: ...
10 views

### Write your implementation of Ruby's String#count method

The task is to write a simplified version of Ruby's String#count method oneself. Simplified because it doesn't have to have the negation and sequence parts of the original. Here my solution: ...
15 views

### LeetCode 639: Decode Ways II

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem A message containing letters from A-Z is being encoded to numbers ...
20 views

### Filtering a Vec of structs and creating new vector of Strings or strs in Rust

I'm working through the Rust book, and it has the following example of how to use the filter method on Iterators (source): ...
70 views

### How can I optimise my code with BufferedInputStream

Suppose I have an InputStream that contains text data, and I want to detect all words and their numLine. I reach for every word ...
34 views

### Using setInterval() to make data reactive

I have a video component passing data from an async GET request to a child component: ...
22 views

### Chemical reactor with UV light project in python

Introduction I'm new to python and made this code which computes the decay of sulphur dioxide (SO2) pollutant in a chemical reactor by ozone (O3) when it is hit by UV light. Code description Short ...
26 views

### Single Producer/Multiple Consumers in Node

I've done my best to contrive an example of the problem I'm trying to simplify. I have a pool of workers, and each worker can do several tasks at a time. Each task takes an unspecified amount of time. ...
128 views

### Deleting a node in a singly linked list?

Please critique the following code on removing a node from a singly linked list, at the moment it seems to me like the code is quite clunky. ...
25 views

### Weather Forecast Web Application

I've made a Python Flask app and I have some questions about the structure of the main module (equivalent of index.py). Here is what it looks like: ...
59 views

### F# method to insert, update, or delete events in a dictionary

I have the following code: ...
18 views

### Fix Hangman Game in Python [duplicate]

Can someone help me make a losing conditon in the function of " engine() " . i cant seem to make it because making an "else" loop causes the function to recheck it to every ...
8 views

### OpenCv webcam streaming class for WPF

My goal is to make a class that wraps the complexity of OpenCvSharp implementation to show a webcam streaming into a WPF Image. ...
38 views

### Red-Black Tree Implementation in Python

i'm wondering if there are better practices, and optimizations, i could make on my code, to do things easier/faster. I have added comments, in many places in the code, to make understanding easier. <...
20 views

### What's the proper way to do MongoDB aggregation query with optional parameters?

I have this api endpoint where i want to lookup a user or multiple users schedule and also specify the month or/and the day when doing the query. My code works, but i feel like there is a better, ...
40 views

### LeetCode 862: Shortest Subarray with Sum at Least K

I'm posting my code for a LeetCode problem copied here. If you would like to review, please do so. Thank you for your time! Problem Return the length of the shortest, non-empty, contiguous subarray ...
26 views

### Coordinates Struct for Flow Field Pathfinding… am I doing this right?

I am slowly creating a flow field pathfinding solution for Unity3D. I'm trying to follow Elijah Emerson's description, which appears in the book 'Game AI Pro' (volume 1). The map is divided into ...
126 views

### Working with images in multiple formats

I've been doing some research around how to best make use of the WebP images (with fallback) in React. Most solutions point to something similar to what I've written below. That means if I have a lot ...
64 views

### How to make Print() method memory & CPU efficient?

Problem Statement You are receiving n objects in a random order, and you need to print them to stdout correctly ordered by sequence number. The sequence numbers start from 0 (zero) and you have to ...
7k views

### Thread-safe LRU Dictionary in C#

Can't seem to find one, so trying to build a very simple but fast implementation. Thought I would post on SO for review/feedback, and so that others can just copy/paste for their own use. I'm using a ...
25 views

### Implementing a Queue with Small size optimization

I was trying to implement a queue implementing the small size optimization. I was wondering any ways I can make this code better (more performant, better code style, etc). It seems to work fine (in ...
37 views

### Typescript interface union with different properties [closed]

I have an object with three possible properties: ...
65 views

### DNA Translator and Verifier (using BLAST)

Proteins are chains of amino acids. Amino acids are coded by codons, a sequence of 3 DNA/RNA molecules. DNA also has 3 open reading frames. This is basically the DNA sequence, but shift it by 1 (i.e. ...
15 views

### vba Copy Paste Transpose Link

Following takes a range & copies, pastes, transposes & links. There doesn't seem a way in vba to do this in 1 go that I've been able to find. Questions are; Is there a more efficient or safer ...
45 views

### AVL Tree implementation Based on VisualGo

I have tried implementing an AVL Tree on my own, based on visualising it. But i'm unsure how many testcases it work with, and how efficient it is. Are there any ways to make it efficient, and compact? ...
24 views

### Webscraping tennis data 1.2: Optionals, Streams, Callbacks(?)

Through my previous questions, I developed a web-scraper that gets tennis ranking data. Webscraping tennis data: major refactor of code style and program modularity Webscraping tennis data 1.1: ...
46 views

### In-memory database class

I built this basic in-memory database that can support some basic operations, like SET, GET, DELETE, COUNT, etc. As well as support transactions. Some of the constraints are as follows: GET​,​ SET​,​ ...
104 views

### Sorting an object by value w/ sort and reduce

Given an object with unsorted numeric values, such as: const unsorted = { green: 80, blue: 90, red: 30, yellow: 100, } We want a data structure with the ...
13 views

### Cross domain fetch switching in prod vs dev

I'm beginning a redesign of the front end of my Flask app which currently generates Jinja2 template-based html pages. I am trying to develop a new front end in React, but I want the current front end ...
32 views

...
120 views

### Pig Latin Application in rust

Just finished an exercise in the Rust online book and I wanted to know if there is anything worth talking about in the code I wrote... if there's any mistake or optimization possible. Convert strings ...
49 views

### Return reversed integer - Java [closed]

The question is from Leetcode. Given a 32-bit signed integer, reverse digits of an integer. ...
22 views

### Ending Infinity-loop [closed]

In one of my projects I try to loop a main Menu. Somehow the used infinity-loop ends. I even tried to use labels to recall the loop. Thanks for your help Here is my code: ...
848 views

### Go homework interview challenge for Storj

Last December I interviewed with Storj and was unsuccessful after my code challenge. Storj were good enough to pay me for the time it took to complete the challenge, but have refused to give any kind ...
42 views

### Merge the multiple observables responses into a single array

Here's what I trying to do: Given a paginated API, get all the resources using parallel requests. The API returns a limited number of resources per call. So, you need to use an offset parameter to get ...
1k views

### Binary Tree Sort Algorithm (Python)

A Binary Tree Sort is an algorithm that builds a binary search tree from the elements to be sorted, and then traverses the tree (in-order) so that the elements come out in sorted order. Average Case ...