All Questions

Filter by
Sorted by
Tagged with
0
votes
0answers
14 views

C++ - Tic Tac Toe AI powered by minmax algorithm

This was my previous post on Tic Tac Toe in C++. I received very good feedback and tried to implement all of the improvements. I could not implement some due to the AI needed functions or complexity. ...
-1
votes
0answers
12 views

Find All Subtrees in Binary Tree. Complexities

So I believe i finally solved this, I testes a few cases, But please feel free to point out any. I am mostly trying to figure out the time/space complexities of this solution. Because binary trees are ...
0
votes
0answers
23 views

Optimizing code (style and logic)? Leetcode #5

Being completely upfront, I know this isn't good code. As the title says, the code is a solution to leetcode #5, which asks to find the longest palindrome in a string. Link here: https://leetcode.com/...
2
votes
3answers
75 views

Fantasy Character Creation Tool (early prototype)

I recently started studying C++ programming; while attending the course I'm writing a program on the side as a personal project to familiarize with what I'm learning. It is still very basic and I'm ...
1
vote
0answers
10 views

Outlook VBA to Replace Tokens from an email template

I'm creating a few macros that open specific Outlook templates an allow you to replace specific tokens before sending the email. It seems to work, but I'm admittedly doing full loops when I probably ...
0
votes
2answers
47 views
0
votes
0answers
11 views

Weather status on dashboard design

So I've made a dashboard, and I have alot of colors / icons on this page. One of the things I wanted to get some others view on was the design I've choosen. I use bootstrap background colors: ...
0
votes
0answers
11 views

Simple flex-based design for automotive sales platform in HTML5

This is my code for a simple used car sales platform, with flex used for the DIVs: https://jsfiddle.net/m56npe32/ I am looking for constructive criticism on how to improve the design, as the entire ...
2
votes
2answers
48 views

Print a Connect 4 board

I am required to code (as part of a 3-question assignment) a variable-size connect 4 board with a standard size of 6x7, with a minimum size of 2x2 and a maximum of 20x20. The professor said that he ...
2
votes
0answers
17 views

Python 3 Multi-connection downloader

I have written a fully functional simple command line multi-connection downloader, written in Python 3, using just threading, ...
0
votes
1answer
33 views

Convert string to 10 character string with leading zeros if necessary

I have the below data and am obtaining the expected output column for it. ...
4
votes
3answers
280 views

Disjoint-set data structure (C++)

I'm an intermediate-level C++ programmer aiming to write reference-quality code. I hope to learn about any mistakes in this piece of code and blind spots in my understanding of concepts. Notes: The ...
1
vote
0answers
21 views

First attempt at chess in Python #2

Almost a month ago I asked for some review of my first attempt at Chess in Python, with the main goal being to start learning inheritance in Python. It can be found here: First attempt at chess in ...
1
vote
1answer
43 views

Optimizing Code for Project Euler Problem 04

I just finished Problem 04 on Project Euler, and I was looking at ways to optimize my code, just started learning functions too, so I'm pretty sure it's very bad, hopefully you guys can help me. ...
0
votes
0answers
12 views

Console logging multiple false conditions, how to refactor efficiently? [closed]

I'm trying to improve my code and have better logging. Is there an ideal way of how to tell which conditions are false in a list of conditionals? i.e) ...
0
votes
0answers
10 views

Display product summary for an e-commerce website

I am working on an e-commerce website. I want to display products in the search result. Here is a subset of what I am doing to display the images. I am using flex ...
1
vote
0answers
11 views

Dictionary based non-local mean implementation in Matlab

Given a dictionary including multiple X-Y pairs where X, Y are both three dimensional structure. dictionaryBasedNonlocalMean function return a ...
1
vote
1answer
21 views

Data processing with the CERN ROOT framework

Problem. I have a directory of .root files (the proprietary format of CERN's ROOT framework). These files contain so-called <...
0
votes
0answers
27 views

Bulk operation in DDD logic [closed]

I am currently exploring DDD and have read quite a bit about the topic, but as I am working on more complex scenarios, I am thinking about the proper way to solve the conceptual issue of bulk ...
0
votes
0answers
19 views

Time Complexity of my 2 pointer algorithm

For the given problem below, what would be the time complexity of my solution (below the problem). I think it is not O(n^2), but I am not sure if it is O(n). Problem: You are given two strings s and t....
1
vote
0answers
27 views

Fancy new LAMBDA functions with variable number of arguments to mimic native methods - no VBA

The TEXTJOIN function has a really nice interface: =TEXTJOIN(delimiter, ignore_empty, text1, [text2], …, [text252]) ... where ...
1
vote
0answers
18 views

Learning asynchronous caching by implementing one

After implementing a serial CLOCK second-chance cache in C++ without having enough rope to shoot myself in the foot, decided to dive into Javascript through NodeJs and write an asynchronous one. I ...
-1
votes
0answers
29 views

Product except self - Naive and Horner's method

I am going through common interview questions and came across this one. Aside from the complexity of my naive solution, why is this approach not correct? I am essentially computing the result as ...
0
votes
0answers
25 views

How to refactor this method with unknown number of parameters? [closed]

I have an API which makes calls to another API, in turn. I have some code that, at the moment, is duplicated in all my methods. It essentially is below: ...
1
vote
1answer
35 views

Python code to check the null values in excel files

I want to check null values in excel files where there are many sub folders. I have wrote a python code to check the null values in excel files in each and every folder and the code was working fine ...
1
vote
2answers
37 views

This code replaces each element of an array with the product of every element of the array except the current one. Suggestions for improvement?

This code replaces each element in an array with the product of every other element in the array but the current element, without using division. So, for the array [5,2,3], the program outputs [6,18,...
1
vote
2answers
58 views

Online Judge 10189: Minesweeper (C++)

I'm new to C++ (not to programming in general), which I want to learn to participate in some programming contests. I solved the Online Judge Minesweeper Challange. Since I'm not familiar with C++, any ...
2
votes
0answers
23 views

Use formats phone numbers into XXX-XXX-XXX

I created an input that accepts and formats phone numbers into XXX-XXX-XXX. The user should be able to type numbers and the dashes should insert themselves automatically. Example #1: The user types 1 ...
0
votes
0answers
17 views

How to avoid getting a duplicate entry in the slice of slices in this Go solution? [closed]

I'm trying to solve this Go problem - 3Sum in Leetcode with Go. Have obtained the result almost right, but facing a problem with duplication of one of the slice entries, though I've added a logic to ...
2
votes
2answers
439 views

C++ Minimal CSV parser

I wrote a minimal CSV parser for my machine learning toy project. ...
-2
votes
0answers
15 views

I made a win function but now i can only place 1 tile, [closed]

So i made a hangman game using pygame and following a tutorial, now i am trying to make Tic Tac Toe on my own but the check win statement now only lets me place down 1 tile before stopping the game. ...
2
votes
2answers
82 views

sorting worksheet by a given column

My code runs exactly as it should. However, I would like to make it run a bit faster. I have tried defined some variables to 'Long' to run it faster but it still a bit slow. Is it possible to remove ...
1
vote
2answers
36 views

A circle in a circle

Just experimenting some things with css, I made a centered circle div (inner) which is inside a circle div (outer). ...
3
votes
2answers
77 views

Prioritise injured cats for treatment (dictionary/map search optimization Python and C++)

I am once again attempting another CP problem, and I have ONCE AGAIN run into an optimization issue because of the time limit of one second: https://open.kattis.com/problems/doctorkattis It is common ...
0
votes
0answers
7 views

Socket.io: Pairing from two rooms without repeated pairing?

I'm working on a user-pairing algorithm using socket.io, and it is running on Node.js. I want to make sure that no repeated pairings will happen when people connect in. The steps of the algorithm as ...
0
votes
0answers
15 views

Extendable Validation Library

I'm looking to develop a validation library which can be extended by adding custom validation rules. To write a custom rule, simply write a class and apply the ValidationRule decorator like so: ...
2
votes
0answers
11 views

Reliable separation of Steam users

I wrote this bash script to try to make sure save games don't get mixed between different steam users using the same Ubuntu account. It uses inotify to try to figure out when a user changes and a soft ...
0
votes
1answer
42 views

Concatenate two vectors and store the result

I code in Rust, but one doesn't need to be familiar with Rust to understand the question. We are given the two vectors, first and res. Our goal is to append res to first, and then to assign the result ...
0
votes
1answer
64 views

Whats the best way to refactor a POCO class

In work I was asked to fix a bug which involved me making changes in a class. To fix the bug I needed to add a collection of a class that looks like this. ...
1
vote
2answers
47 views

Comparison of 2 different ways of writing Merge Sort Algorithm

I have recently learned Merge Sort algorithm in C++ with 2 ways of writing it. 1st Way: ...
1
vote
0answers
7 views

golang http.Client wrapper with rate and concurrency limiting

My goal is to safely consume an API without getting 429 Too Many Requests error, activating DDoS protection or going over system limit of maximum open file ...
-2
votes
0answers
29 views

Performance optimization of nested dict

I have been currently working on which way is the fastest way to get a nested dict. By spending few hours with researching aswell as asking people I have ended up creating my own test which I do not ...
5
votes
6answers
2k views

Adding Odd numbers in C++

I have written following code for the this C++ Problem: Write a program to add only odd numbers between one to ten. ...
1
vote
0answers
23 views

Event handling with async await in Python

Recently, I had to write a code to classify and rename lots of image files based on their content. So, I wrote a Python script which displays all those images as a slideshow to the me, and I can ...
2
votes
1answer
42 views

Python: lru_cache make leetcode's dungeon game more slower

I'm trying to implement a recursive+momoize version for leetcode's dungeon game question. I tried to use @lru_cache(): ...
0
votes
0answers
40 views

Unwinding in Python [closed]

My scenario is as follows: I need to write a Python script that does a series of steps. Specifically what it does is: Clone a git repo Change some tokens in this repo Create a remote repo in our ...
0
votes
0answers
44 views

Gilded Rose with pure functions in C#

Gave myself the challenge of solving the Gilded Rose with pure functions in C#. All one-line lambdas, all static, all the time. The original kata assumed the code would mutate the given array-- I've ...
-1
votes
0answers
39 views

making this nested for loop more pythonic [closed]

I have a clunky (but working) piece of code as shown: ...
-2
votes
0answers
54 views

Best format to store user informations [closed]

I want to store user informations such as their names, lang ... I'm currently using Yaml format. This is an example: ...
2
votes
1answer
36 views

Find ALL duplicate subtrees. using recursion

This is just a practice exercise, I'm trying to understand dynamic programming as deeply as I can. I solved this using recursion, though I am not sure if it will always work. If anyone could tell me a ...

15 30 50 per page
1
2 3 4 5
1466