« first day (2738 days earlier)      last day (84 days later) » 

12:00 AM
RELOAD! There are 7078 unanswered questions (89.7432% answered)
2 hours later…
1:37 AM
Q: LeetCode on Longest Palindromic Substring in Python

JackThis is a programming question from LeetCode: Given a string s, return the longest palindromic substring in s. Example 1: Input: s = "babad" Output: "bab" Note: "aba" is also a valid answer. Below is my code that fails the following input because of "Time Limit Exceeded": "glwhcebdjbdroiurzfxx...

I’m voting to close this question because codereview.stackexchange.com is for this purpose. — O. Jones 35 secs ago
1:52 AM
@O.Jones: please don't suggest that this question be asked on code review as it is far off-topic there as well, and they don't want to be used as a dumping ground for our low-quality questions. — Hovercraft Full Of Eels 15 secs ago
possible answer invalidation by AndyP on question by AndyP: codereview.stackexchange.com/posts/251382/revisions
3 hours later…
4:53 AM
Q: C program to print a triangle of stars

JJJohnThis C code is to print a triangle of stars. #include <stdio.h> int main(){ for(int i=0;i<3;i++) { for(int j=0;j<i*2+1;j++){ printf("*"); } printf("\n"); } } which works well though, I'd like to know if there is a better way to do the job, as it's sai...

5:05 AM
possible answer invalidation by user2495123 on question by user2495123: codereview.stackexchange.com/posts/251393/revisions
1 hour later…
6:30 AM
Q: LeetCode - Weekly Contest 213 - Kth Smallest Instructions

Jasmeetsingh BansalHi I participated in Leetcode weekly contest 213 and am facing issue with submission for below question Kth Smallest Instructions Bob is standing at cell (0, 0), and he wants to reach destination: (row, column). He can only travel right and down. You are going to help Bob by providing instructio...

6:55 AM
Q: Leetcode two sums

bullseyeI'm currently learning c++ coming from a python background, so I'll include a solution in python and in c++ for the following problem statement: Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target. You may assume that each inpu...

Q: Reading configuration variables in a Python project

Hooman BahreiniI am new to python, in .NET we use web.config to store environment specific variables... I want to achieve the same for my python program (scraper) I have created .env file at the root of the project and added the following variable to it: CHROME_WEB_DRIVER=C:/webdrivers/chromedriver.exe Note t...

1 hour later…
8:25 AM
Do you have a specific question, an error or something you don't understand? If you want advice on your working code then I recommend migrating your question to codereview.stackexchange.comsorifiend 58 secs ago
9:22 AM
Q: particle swarm optimization algorithm and 2D array partitioning

Hanin Farhanif I have a large 2D array let's call it a dataset and I want to divide it into a number of 2D array of equal size that is smaller and easy to processing it(let's treat it as chunks), by using PSO algorithm I take the best position values, utilize it as an index of the dataset then putting these ...

9:46 AM
Q: LeetCode 173: Binary Search Tree Iterator

alisianoiThe original problem statement is here, here is the super short summary: Your binary search tree iterator must implement the following interface: pub struct TreeNode { pub val: i32, pub left: Option<Rc<RefCell<TreeNode>>>, pub right: Option<Rc<RefCell<TreeNode>>>, } struct BSTIterator {}...

10:11 AM
Q: Largest rectangle areas after drawing boundaries

hbjORbjI was asked the following question while trying to get a Hackerrank certificate. I couldn't solve on time but I now completed the solution. Can you please check if my solution seems good? Suggestions on improvement are appreciated. Q: You have a rectangle of width w and height h. You will start t...

10:59 AM
Q: Validating ISBN-10s, with or without dashes in C++11

Al2110Description A regex-based method of validating ISBN-10 as strings. Can be digits (or 'X' at the end) only, or with dashes, according to those of English-speaking publications (which are defined by the regular expressions contained in the code below). The last digit, a check digit (unless it is an...

11:24 AM
Q: Type ahead in JS

bona-petiteI've been following Wes Bos challenge, I wrote the code myself then looked at his finished example. Here's my code (I only wrote the JS): const cities = []; const endpoint = 'https://gist.githubusercontent.com/Miserlou/c5cd8364bf9b2420bb29/raw/2bf258763cdddd704f8ffd3ea9a3e81d25e2c6f6/cities....

12:13 PM
Q: Find the max value between minimum values in sub-arrays

AdamantoisetortoiseI have an array of integers, I have to find all sub-arrays of different size from 1 to len(array). In every sub-array I have to find the minimum value in it, once done I have to find the maximum value between the minimum values of all the subarrays of the same size. Finally I have to return these...

12:24 PM
Show requirements, relevant code, output and/or possible error messages as properly formatted text in the question, not as image or by external link. Also consider codereview.stackexchange.com for questions about working code. — Michael Butscher 13 secs ago
1:02 PM
Q: Out of N number of participants, draw out M winners

deeper-understandingIt could be a simple Fisher-Yates, but then if the number of participants is 1,000,000 and the number of winner is only 3, then we really don't need to shuffle the whole 1,000,000 numbers, so the following is to reduce the number of steps, written as a simpler case of drawing 9 winners out of 30 ...

Q: Double-ended queue for Embedded Systems with different data size

MrBitI decided to modify my last code about a queue intended for embedded systems and make it accept different data types for multiple purposes. It is a double-ended queue, the user can store and get elements to and from each end of the queue . The queue uses a static allocated buffer - array. The use...

1:26 PM
Q: How to add a button in jsgrid table that fetched data onclick

omkar more $("#jsgrid-basic").jsGrid({ height: "500px", width: "100%", filtering: true, editing: true, inserting: true, sorting: true, paging: true, autoload: true, pageSize: 15, pageButt...

2:11 PM
The Designer.vb files are not "auto-generated". That would suggest that they are redundant, and that there is a source file from which they can be generated. What makes them different is that they are (usually) edited using the Windows Forms Designer. This tool is fundamentally broken, given that it can add hundreds of unrelated and unnecessary changes in addition to your own.This could also be the case for any source file. However, it shouldn't be that way, and in any case the Designer.vb files should be included in a code review. — rymdsmurf 36 secs ago
Q: Finding number of solutions nqueens 14 by 14 chessboard

Michael WI have written a code to solve the N-Queen problem for a 14 by 14 chessboard. There are preplaced queens (see below for the sample input and output). The lines of sample input (after the 3) represent the positions of the preplaced queens. For example, "1 1 2 9 3 6 4 10" refers to the 4 preplaced ...

2:40 PM
3:30 PM
Q: An element_wise_multiplication and an element_wise_division Function For Boost.MultiArray in C++

JimmyHuThis is a follow-up question for An element_wise_add Function For Boost.MultiArray in C++ and An Add/Minus Operator For Boost.MultiArray in C++. Besides the basic element-wise add / minus operations, I am trying to implement an element_wise_multiplication function and an element_wise_division fun...

1 hour later…
4:31 PM
All 2xx status mean success. But you are only returning success for 200. Rest is fine. Maybe you need a code review from codereview.stackexchange.comRashomon just now
If you're not sure where the code is inefficient, then you need to profile it. As this stands, the question is no longer appropriate for Stack Overflow; instead, it would go to StackExchange.CodeReview .... but read their posting guidelines first. — Prune 15 secs ago
5:32 PM
Q: Find the shortest sub array that contains all element from 1 to K

arcticOak2I'm trying to solve this problem [here][1]. The question is all about finding the shortest sub array inside an array that contains all the element from 1 to K. Input: The first line contains three space-separated integers N, K and Q. N is the length of actual Array, we need to find the shortest ...

Q: stdin getline wrapper

LincolnI'd like to read a line from stdin, excluding the newline character. I've written the function: /* read in a line from stdin, NULL on failure * does not include trailing newline */ char* readStdinLine() { char* buffer; size_t bufsize = 32; size_t characters; buf...

This is very close to asking for improvements to working code, which is off-topic for Stack Overflow and on-topic at Code Review. — Jonathan Leffler 32 secs ago
1 hour later…
6:45 PM
Q: TodoItem component type checking for optional prop

MauricioRobayoI have a TodoItem component that looks like this: type Todo = { id: string; text: string; isCompleted: boolean; createdAt: string; }; type TodoProps = { todo: Todo; removeTodo: (id: string) => void; markCompletedTodo?: (text: string) => void; }; const TodoItem = ({ todo, removeTod...

6:57 PM
If you are looking for a review of working code, probably check whether this would be acceptable on our sibling site Code Reviewtripleee 48 secs ago
I’m voting to close this question because it's asking for Code Review. — ekhumoro 39 secs ago
7:59 PM
Q: Simple Machine Language simulator

theProgrammerThis is a simple machine language simulator that handles basic operations such as read, write, load, store, add, subtract, multiply, divide, modulus, branch, branch if negative, branch if zero. Inputs are gotten from the user in hexadecimal, the memory is simulated as a built-in array of integers...

8:23 PM
Q: Python function - use config constant or put ID numbers in function?

caseymI am refactoring a function that calculates how many days to add to a process based on destination country or state. The original function called the database twice, even though the database table stored four values. My thought is to remove the database calls and use a config constant, or simply ...

9:12 PM
Q: Line plot for env rendering matplotlib

RicardoI have a reinforcement learning custom env made with openAI gym. How can I improve the def _init_plt(self) function below? I included the code before it for reference as well. Please be brutal with your review. scroll down for init function, generates a subplot with axes: # Imports import gym...

9:54 PM
I doubt it. I'm guessing option 1 is slower (more operations). If I saw option 1 in a code review you'd be re-writing it to option 2 since it is much clearer :-) — John3136 20 secs ago
10:15 PM
possible answer invalidation by AndyP on question by AndyP: codereview.stackexchange.com/posts/251382/revisions
Q: Data Visualization (rendering env)

RicardoHow can I improve this code? It renders a ML env with openAI gym and matplotlib. I am new to coding so not sure if my variables or format or any lines can be improved. ``` def _render(self, obs): """Renders the environment. """ ball_loc = obs[1] x, y = self.circle.center new...

11:10 PM
possible answer invalidation by Deduplicator on question by Al2110: codereview.stackexchange.com/posts/251415/revisions
@Duga No invalidation, cleaning up some text.

« first day (2738 days earlier)      last day (84 days later) »