instruction stringlengths 71 95.1k |
|---|
Problem description
Scarpi, who owns a restaurant, decided to remodel
it with his friends because the interior of the restaurant is too old.
The place where the restaurant is located is a very cold area in the
snow town, so it is necessary to check the condition of the exterior
walls periodically during the in... |
The idea about this code is that it's a full replacement of Redux — in 22 lines of code.
let state = null
const beforeSetStateCallbacks = []
const afterSetStateCallbacks = []
export const beforeSetState = (fn) => beforeSetStateCallbacks.push(fn)
export const afterSetState = (fn) => afterSetStateCallbacks.push(fn)
exp... |
I am trying to practice the Observer design pattern in Golang, here is my code. I would be pleased to receive your comments, improvements, etc.
package observer
import (
"container/list"
"fmt"
"math/rand"
)
//interface that receive updates
type Observer interface{
Update(s *Subject)
}
// interface th... |
I have computed the Daubechies wavelet and scaling filters in float, double, long double, and quad precision, and now want to expose these filters in a usable API. My problem is as follows: I want to make sure that these filters are correct to every single bit, so I wrote them as hexadecimal floating point literals. Th... |
Just wondering how I can go about doing this more efficiently/make it more visually appealing to the user?
switch (this.state.selected) {
case "all":
styled = this.state.allKeywords.map(keyword =>
<div style={{display: "flex", flexDirection: "row"}}>
<Input key={Math.random} style={{height... |
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
The MessageBroker Class
Contains thread-safe structures to hold mappings of message types to handlers. Dispatches messages
t... |
I am currently creating a website for an artist (my grandfather). My main concern with the code below is readability, as for the most part I have not worked with others on a (programming) project. I use a few external modules but hopefully their purpose is obvious/irrelevant.
I have been programming with javascript as... |
I wrote simple code that let users log in, see what items are available in "shop", and make a purchase if he/she has enough coins.
Because the code uses csv file, if you want to test the code, you will need to create one. Run following
import csv
#Path to the folder + file name
file_path = input()
#Each sublist cont... |
I implemented a simple solution to the Producer–consumer problem
that I'd love for you to take a look at.
The producer simply adds random numbers to a queue and the consumer (from a separate thread) pops numbers off the queue and prints them. I'd specifically like feedback on the concurrency aspects of this implementa... |
I'm working with one environment which allows me to execute node.js code from single file without installing additional modules. My task is to write simple ssl socket client which will send protobuf message, receive response in same format and decode it.
What I developed in this code example:
protobuf decoder/encoder ... |
I have made a multithreaded command runner that works, just wanted to share the code and see if you guys can see any pitfalls. Comments are not part of actual code
protected async Task<bool> PollQueue(CancellationToken cancellationToken)
{
async Task<Batch> SyncQueueTask(CancellationToken token)
{
await... |
This a fairly basic script I made for use in some other projects, nothing too complex or sophisticated and obviously lacking in some features (Password/Username encryption, Missing file contingencies etc.).
It loads a text file (formatted as USERNAME, PASSWORD\nUSERNAME, PASSWORD\n) into a 2D array, then checks the inp... |
Problem: We read a complex json-file which grants us a tree in terms of a python "dict of dicts". We're then requested to retrieve a specific path from the tree, represented by a list of elements. The list (i.e. the path) may have any, arbitrary length.
Simple Example:
# The dict-tree:
d = {"a":{"1":{"aa":"a2", "aaa":"... |
I'm working on a custom puppeteer script which converts dynamic generated HTML to an A4 PDF.
This script converts HTML to a near perfect A4 PDF file, the only issue I have is speed. Document conversion is anywhere between 1-10 minutes.
I have tracked the slowness to the part where we calculate how much vertical space n... |
I'll have to move a large network directory with many sub-directories and thousands of files. A number of users work on these files on a daily basis. OS is windows.
The move itself (copy and delete) I'll do using robocopy.
Before starting the batch process of moving, I would like to check for locked files. In case some... |
I'm just starting in Go.
Please review the below code, and let me know what I can improve in this code.
//BubbleSort takes an []int {7,5,6,9,8} and returns {5,6,7,8,9}
func BubbleSort(arr []int) []int {
keepRunning := true
for keepRunning {
keepRunning = false
for i := 0; i < len(arr)-1; i++ {
... |
I took a crack at solving the problem of finding the averages of all subarrays of length k. Here is what I came up with. I would greatly appreciate your feedback on my code.
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
vector<double> findSuseqAverages(size_t k, ... |
Users can have a Cookie called lang that contains either the value "default=1" (English) or "default=2" (French). This cookie is used to determine their preferred language. I have a function that needs to take the cookie and return the language has an Enum. If the cookie doesn't exist, I want to return English. I canno... |
I'm currently working on a procedural generated terrain.
I've written the Chunk script, and it works great. When I generate a few chunks in Unity, it runs alright, but it could definitely run better!!! Currently I am not instantiating new chunks at runtime, but when I do, it starts lagging.
I've been looking at multi... |
I want to compare two solutions to the following question from Cracking The Coding Interview by Gayle Laakman McDowell :
1.7 Rotate Matrix - Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a method to rotate the image
by 90 degrees. Can you do this in place?
We will be ... |
I'm writing a decryption algorithm using GA with crossover and mutation. My performance is (very) poor, often stagnating early or converging to the incorrect solution. I just want some other people to look at my crossover and mutation methods to see if something is amiss.
Note: crossRate and mutatRate are the crossover... |
I'm facing the problem of needing to instantiate lots of cars, and I'd like to recycle the cars no longer used.
Each one of my car types, which define how each car should be created, are treated as singletons and there will never be two instances of the same type. I could program this in the example, but lets just ass... |
I would like to speed up the following code in R. This is a loop to define new individuals (column newID) when the variable change is equal to 1. Any idea on how to improve the loop will be greatly appreciated.
Here is the code:
## Build the data frame
dat <- expand.grid(x = 1:1000, ID = as.character(seq(0, 4000, 1)... |
I have been learning C++ for 3 months now. I decided to make something by myself, so I've made this little integer-based TIC TAC TOE console game.
I need some advice
on how to improve my code for better structure and and better readability.
#include <iostream>
#include <stdlib.h>
using namespace std;
int arr[9]={0,1... |
I have a code that turns all comments size to autosize, however as I have quite a few cells with comments, this code runs a little slow, to the point where it will become non responsive for awhile.
Sub AutoSizeComments()
Dim c as range, ws as worksheet
Set ws = ActiveSheet
'Loop through each comment on wo... |
I have the structure Corporation/Company/Facility/Storage and only Storage could be part of Facility, and Facility could be part of Company, and Company part of Corporation. My main problem is for the code to work I need to add the Corporation to itself.
public class BusinessEntityData
{
public Guid ID { get; set; ... |
I want to manage the Excel Styles in a more flexible way with bulk actions and at the same time improve my newly acquired OOP concepts.
Objectives:
Load the current Styles list (name and type=builtin or custom) in an Excel Structured Table (ListObject)
Allow users to:
Delete
Duplicate (create a new style based on ano... |
I am currently learning Java programing by building real life business application for repair shops. I am posting this code so I can get critical review, and change my application architecture if necessary. I would like your opinion on my approach to MVC pattern.
This is a GUI swing class for one of the dialogs.
public... |
Problem Link- https://www.hackerearth.com/challenges/competitive/october-circuits-19/algorithm/ap-1-f43562f4/
Problem Statement :
You are given an integer array of size A. You are also given queries Q. In each query, you are given three integers L, R, and D respectively.
You are required to determine the length of ... |
I had this S3Helper class before such that, every time I called a function to any of its methods (which I haven't shown here, but which do things like upload files to s3 or get temporary s3 links), it called the getClient() method and it would make a new client every time.
Now I don't know about the performance hit on ... |
I wrote a minimal implementation of the MD5 algorithm. Comparing to the established MD5 crate, the crate has a 35% better throughput than mine. I'd like to know why.
In reviewing the crate's code (relevant section here), I see that it essentially does the same thing as I do. I don't see anything algorithm differences. ... |
I have to write a code which takes (integers) numbers from Command-line and keeps reading the terminal until it gets a word END
So I wrote the following; I feel its really bad. Is there any way I can improve below code
I updated my code from previously to below
func main() {
buf := bufio.NewReader(os.Stdin)
lin... |
Updates: I kept the original code here, while performed some changes on my machine, including:
fixed the incorrect return documentation for clear()
made the closing functions recursive too (to be more clear and order-safe)
moved the static inner classes into separate files
extracted the API into an interface
use .addS... |
Write a function that returns a string length N of alternating strings: "A" and "B", starting with the 1st string. How could this be improved for be more performance or efficiency?
Eg: num = 5, should return "ABABA" & given num = 2, should return "AB".
function solution(num) {
const str1 = 'A', str2 = 'B';
let res ... |
I am verifying certain codes that work well and I don't know what else to optimize in them or what other tests to do: in this case it is a php script that takes the data of the $_POST variable analyzes them and converts them into an array, this is since in some cases the post field may contain a JSon string.
I leave a ... |
I have multiple inputs that each one has an increment and decrement button
The buttons will be pressed multiple times so i am looking to optimize my selector:
So should i keep the first one (which selects by attribute) or the second? Or anything more optimized.
$("[data-id-col="+thisID+"]")
$("input:tel#"+thisID+")
... |
My database:
Class:
Class Category {
function __construct($db) {
$this->db = $db;
}
public function groupByUnderCategoryName() {
$query = $this->db->prepare("SELECT categoryName, id, title FROM test2");
$query->execute();
return $query->fetchAll(PDO::FETCH_GROUP);
... |
I like to request a review of the code below, which is my attempt at answering the question here on LeetCode site. The code passes 43 tests, but it times out on the next one. I copied and ran the test on my machine using visual studio and it seems to give me an answer. I wonder if there is something about the site Leet... |
I have an application which requests data from a REST endpoint 50 items at a time and displays results in the UI. I would like to paginate each API response into smaller arrays for display and then request a new API resource when the user reaches the end of the children arrays.
I have a working CodePen demo using the S... |
I'm new with Ruby and am trying to improve my coding skills. This program gets personal information for three people, and then prints them.
It works, but I'm sure it's not the best and certainly not the fanciest way to do it.
I was hoping to get some advice here on how to do it faster/shorter/better/smarter...It is re... |
I am trying to get equal number of records in both columns, even if that means that first column doesn't fill page to bottom on the second page. The only way I was able to do this was by using a maxrow count and breaking when it is equal to the max row count.
public List<DataForExcelExport> GetData()
{
... |
So I'm trying to implement the following problem in a couple of different languages to get a rough idea of how different languages work & feel. I'm completely new to C, and this is the first code I've cobbled together using the C reference and Google/SO.
The problem is this:
Generate a list of n random doubles in (0, ... |
I have the following code:
member this.ProcessEvent(sourceStream: OrderResponse) =
match sourceStream.Action with
| Action.Partial
| Action.Insert ->
sourceStream.Data
|> Seq.iter (fun x -> this.orderState.[x.OrderId] <- this.ConvertFullOrder x)
| Act... |
At the company i work we have a system where an user is presented with a question and some alternatives to choose from. The question and answers are generated at runtime. In order to simplify the process among the sent payload is an encrypted JSON string that contains some "sensitive" (but not that much) information an... |
I'm trying to filter items from an ecommerce site.The project on the local server was running smoothly.However, I noticed significant delays since the project was published on the global server.Most often happens when changes are made to the price range.
Here is the Ajax code:
productFilter = {
catId: $... |
The purpose of the code is to allow the user to select directories that will be crawled recursively in order to find particular files or file types to analyze en masse. The thing to bear in mind is that if C:\ is already selected, then any child path of C:\ that the user tries to select will be discarded. The entire pr... |
This is a follow up to this question
Code incorporates Mathieu's comments and it works. As some parts of the review left some code to my knowledge, I ask for another review to see if I implemented them correctly.
Objectives:
Load the current Styles list (name and type=builtin or custom) in an Excel Structured Table (L... |
This is the task's description. My code gets 100% task score. Is it good code yet? (I think I'm getting a lot better, since I started solving this codility's exercises and posting here, but I always get important things to improve -which help me A LOT!- from reviewers)
N voracious fish are moving along a river. Calcul... |
I'm new to R and have created a dictionary function. A user will input a phrase into a text field and the server will read it and see if there's a match in a back-end data table and if so, output the abbreviation of the phrase.
This dictionary data table does not have a 1 to 1 mapping. The dictionary has logical_word a... |
I am trying to build a fast cryptography algorithm. The algorithm works fine, but I am worried if there are any potential flaws that might make the algorithm vulnerable to any kind of attack. Here is my code.
Encryptor.cpp
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace st... |
I have these queries written in Entity Framework where I try to get:
Name of the customer
Most Recent Invoice Ref
Most Recent Invoice Amount (£)
Number of outstanding invoices (#)
Total of all outstanding invoices (£)
I use these two tables:
CREATE TABLE Customers
(
CustomerId INT,
Name NVARCHAR(100),
Add... |
The following code is designed to cache a (UTCTime, Text) value that keeps the Text token around until it expires, preventing needing to re-fetch the token each time this third party API is called. I feel like this duplication in APIDefaults and APIEnv could be removed, perhaps through a type parameter, though there ma... |
I have an attachment uploading feature in my web app.
File can have type- image/png or image/jpg or image/jpeg or application/pdf
For images, I need to return Photo, for pdf Document.
Documents will be only pdf, but images can be extended to images/ico, etc.
Now my code looks like this.
getAttachmentType(attachmentType... |
I solved an online judge problem named Jollo.
The full description of the problem can be found here:
https://www.urionlinejudge.com.br/judge/en/problems/view/1321
It's a card game between 2 players.
Each player is given 3 cards.
Each round a player shows one card and removes it from hand.
The player who shows the highe... |
I have a program that returns the following:
PS4 Modern Warfare (2019)
Xbox One Modern Warfare (2019)
PS4 Grand Theft Auto V (5)
Xbox One Grand Theft Auto V (5)
I want to remove the parentheses from the end of he strings so they would look like the following:
PS4 Modern Warfare
Xbox One Modern Warfare
P... |
I am learning dynamic programming. I read articles for the rod cutting problem and I applied it in cpp, and I got a doubt, does the below code solves the problem through memoization (say, previously rod(3) was solved, then if same function was called with same parameters) has the answer, or will it use tabulation (rodM... |
Looking at back at the C++ projects I've developed, the Makefiles are a mess. To tell you the truth, I copied one a long time ago and basically have been cutting and pasting it haphazardly ever since. I've decided to change that so I've been reading more about how Make actually works and some best practices for using... |
This code basically just does a Caesar cipher on the contents of the variable "s" with a shift of 1.
Sorry if the comments on the code don't explain it well. I'm quite new to Python and I'm not very good at explaining.
Can this be code be improved?
# Imports the lowercase alphabet as a whole string.
from string import... |
Answering a question on S/O about type annotations led to me writing a little decorator that adds type checking to functions with annotated arguments. It supports the meta types Any, Optional[], and Union[], as well as combinations such as Optional[Union[...]]. It takes no arguments itself, for ease of use.
I'm fairly ... |
I am working on an angular stack that has n amount of services that hold data in stores of this type:
fooStore$ = BehaviorSubject<FooStoreType>({})
accessing properties in these have generally been done like this:
export wantedPropSelector$ = fooStore$.pipe(
map(store => store.wantedProp)
);
Now I'm working on impr... |
I am a beginner who just picked up Java (2 months ago) and I am solving some questions. For this question, the overall problem wants me to choose the cheapest price plan, so I listed out the possibilities of every plan and 'hardcoded' the logic by inputting the number of services, as the services is more important than... |
I have got 2 working codes, where one is a bit longer and another a bit shorter. Is it some way to bind all these layers as a one group?
The first one is:
map.on('zoomend', function() {
if (map.getZoom() <6){
map.removeLayer(job);
}else{
map.addLayer(job);
}
if (map.getZoom() <7){
map.r... |
I want to find the longest palindromic substring using dynamic programming in Python3. The strings can be as large as this string.
I have seen other questions on this problem that successfully solve it but I am unable to improve my own code following their strategy.
This, approach 3 is the strategy that I want to imple... |
I wrote cat program in x86 NASM and I would like to know if there is anything that can be improved.
This implementation of cat supports:
Reading from stdin.
Multiple arguments.
I checked few cases and program behaves exactly like original cat command.
I was thinking if I should add labels like write even if I wouldn'... |
I have a code that will delete the row if the entire row is exactly the same. So if in row 1 I have 100,200,300,400,500,600 in column A,B,C,D,E,F respectively, and in row 3 I have the same thing, it will remove row 3.
Sub remove()
Dim a As Long
For a = Cells(Rows.Count, 1).End(xlUp).row To 1 Step -1
If ... |
Please take a look at this little snippet of code and explicate on whether there are an efficiency enhancements that you'd make for it. It standards a row of a pandas.DataFrame by adding zeros to it so that the total length of the datum is the same as the longest datum in the column
Sample "solubility.csv" file for tes... |
I am comparing the index of the current component displayed in the viewport against an array of all the components on the screen to determine to direction the user in scrolling.
Does this function have too many concerns? and can the if statements be reduced to something cleaner?
function getDirection(component) {
l... |
This is my first C++ program (not counting "hello world") and I'd like to know if there are some semantic mistakes or if I could rewrite the code in a more simple way.
It performs brute-force factorisation of the number provided on standard input.
Here is the code:
#include <iostream>
#include <cstdio>
using namespace ... |
I need to extract the dimensions (width and height) of a jpeg file for inserting in an html document. According to the JPEG image compression FAQ, cautions against what's commonly out there,
Some people have recommended just searching for the byte pair
representing SOFn, without paying attention to the marker block ... |
I have a team lead that used to write references in a single script then access it in every script. Like for accessing a variable he has to write code in this way staticRef.scpRefGui.CLDropDown_Ref.Dropdown_ref.value
And sometime I see this kind of function calling staticRef.scpRefGui.CQAScrollViewPOI_Ref.ShowExcelObj... |
I made a program to attempt to find all palindromes in the danish language. Words.txt contains about 50.000 lines of danish words. Palindromes.txt is empty initially.
Im running the program on a Intel® Core™ m3-7Y30 Processor - which has a base frequency of 1.00 GHz. Seeing as the program - as it currently stands - has... |
Below are two ways to calculate an element of the Fibonacci series. Can someone please help me understand why fib1 is so much faster (over 60x) than fib2 ?
fib2 is just an assignment and a decrement whereas fib1 involves a dictionary and recursive calls.
Thanks.
import timeit
def fib1(n, lookup=dict()):
if n == 0 ... |
The original question is as follows:
Consider the leftmost and righmost appearances of some value in an array. We'll say that the "span" is the number of elements between the two inclusive. A single value has a span of 1. Returns the largest span found in the given array. (Efficiency is not a priority.)
maxSpan([1, 2,... |
I want to create a very simple banking application where (i) predefined accounts with a positive balance can send money (ii) requesting balance and a list of transactions can be found.
I have created API for those operations. All the operations are persisted into the database. I also wrote test cases to verify.
I alw... |
I'm trying to create a way to clock in and clock out at work using python and tkinter. There are several features to be implemented.
Change the Employee Name
Clock In button
Clock Out button
Export file with the information
I have all the components and they work when I run the different features individually. Whe... |
I just finished a full minesweeper clone which is based on Minesweeper for Windows 95.
I used C++ and Qt to realize it. The full source code can be find in my git hub.
Since this is too much code too review, I want to focus on the logic of the cells. For that I created the following classes:
Cell: Represents a singl... |
I wrote a simple lighter version of std::shared_ptr<T> called res_ptr<T>.
std::shared_ptr<T> is somewhat heavy due to all the nuances of its control block: support for safe deleting without virtual destructor, support for std::weak_ptr<T> (I am not certain on all details of the implementation... but I believe that it e... |
This was the first game I made not too long ago (2018), and while I'm working on another, more complex version, I want to know how good or bad I did this one and what can be improved.
Note: the change of players and detection of free spaces are the things I did with help of a friend, everything else I did it myself.
#i... |
Suppose my goal is to add elements to list in python if they pass a conditional. There are many ways to do this and I show some. Would it be possible if you could review each block and describe its performance in context of the other blocks? Additionally, if possible, can you provide some performance heuristics for the... |
Best rational approximations is a technical term and not subjective. The best rational approximations are the convergents of a value plus it's semi convergents that are closer to the original value than the previous convergents.
Hi everyone,
I've written some quick code in Python that is my tool for exploring various a... |
I am designing this nice form handling in React/Redux/Saga and I am quite afraid it might not be optimised. So I decided to ask you what you think :)
First of all, I won't get into details how I normalise the json-s to get to this structure, because this post will get huge, so this is how my redux state is being initia... |
This is program that computes the minimum of the function \$y=(ax+b)^2\$. The program will find the value of \$x\$ that gives the minimum \$y\$. It will start with an initial value \$x\$ that you assign.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int a, b, i;
float threshold, xt1, xt0, l_r, x, min_y;... |
How can I speed up this code?
coin=[50000, 20000, 10000, 5000, 2000, 1000, 500, 200, 100, 50, 20, 10, 5, 2, 1]
def matrix(coins, kerdes): # it create a metrix
tabla = [[0 for m in range(kerdes + 1)] for m in range(len(coins) + 1)]
for i in range(kerdes + 1):
tabla[0][i] = i
return tabla
def change... |
Rate limiter has to comply with the spec:
Every request comes in with a unique clientID, deny a request if that
client has made more than 100 requests in the past second.
Would be happy if you review:
import java.util.HashMap;
import java.util.TreeSet;
import java.util.Map;
public class RateLimiter {
private ... |
I am trying to perform optimization using a surrogate model instead of the real function and for that, I need the gradient of my LSTM model with respect to the input. In this case, I have 3 features that vary over time. The LSTM calculates from the initial value of these 3 features the following 100 time steps hence th... |
I'm writing a code generation library, I've exposed a couple of methods and of course in order to define a member you need to specify it's type, the easiest way is to use typeof(Type), which I later format so that it it's compilable and I can insert it as a code chunk e.g. System.Int32, which for non-generic types is b... |
You can set any size of the field, you can set how much you need to put in a row to win. I think I got a pretty flexible program.
What do you think about the code? I would like to know if I made mistakes in program design.
skeleton:
public class Main {
private static String[] turn;
private static int hmInARowT... |
This code checks user permissions for uploading file, and if user can upload, then the file undergoes a check to see if it exists in SharePoint. If so then the file is pulled and uploaded to S3 bucket. This all works fine, but I have been told all these catches create callback hell. I've been trying to implement promis... |
I am trying to solve this question on HackerRank (problem details below).
Naive solution
This solution implements the problem as described and produces the correct solution. It is not very efficient, however, and produces time-out errors on the predefined tests for larger sized arrays of A, e.g. big_A (see below).
big_... |
I have a server and client application. In the client application, there are HttpRequestException class exceptions on requests. As it seems to me - these exceptions happen in isolated cases and not always speak about a connection problem. So I decided to do a repeat of the queries with a small amount of time:
private s... |
I have a bare-bones example of how I plan to load excel sheets into pandas data frames. However, the code runs unexpectedly slow. I'm open to suggestions on ways I can speed this up, even converting the source files to a different file format. Anything to make it snappier because I will need a loop to do this several t... |
I need to build something that is not very complicated, but efficient. I don't have much time to debug.
I don't know if this method is strong enough to encrypt a data to be displayed in a Qr code.
It will be compiled in Qt.
#include <botan/botan.h>
#include <botan/aes.h>
#include <botan/kdf.h>
#include ... |
I have solved the designer pdf question with haskell. The code works. I am posting the code here to know how I could have done it better.
First line contains the weight of each alphabet
Second line contains the word.
Sample input
1 3 1 3 1 4 1 3 2 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 7
zaba
Output
28
Explanation
each... |
Problem
I have a DI scenario where I have multiple classes that implement a common interface (IModelService).
I'm using a generic framework class (PredictionEnginePool<,>) that has options injected (PredictionEnginePoolOptions<>). This has a property (ModelLoader) that must be set using AddOptions in Startup.ConfigureS... |
We need to tunnel certain applications over a VPN at work. Ideally we would use a dedicated firewall/network appliance for this but the only permanent infrastructure we have are Mac Pro's running Squid.
This means that if our VPN connection drops or anything happens to the link, we have to manually click "Connect VPN" ... |
I'm trying to build an API wrapper class, that sends requests in a JSON format. the sample request format is something like this:
{
"items": [
{
"brand": "brand",
"idCategory": "idCategory",
"idItem": "idItem",
"attributes": [
{
"idUda": "idUda",
"price": "price... |
This snippet uses a string as an output. As we iterate through the input string, I just keep appending a character to the string and I know this just pretty much creates a new string everything I add a new character since strings are immutable in Python.
def snake_string(s):
res = ''
for i in range(1, len(s), 4... |
I'm reading Structure and Interpretation of Computer Programs. In the first exercise, I came across a programming problem to add the squares of the 2 bigger numbers out of 3 numbers.
I came up with the following procedure:
(define (sum-of-larger-two a b c)
(
if (> a b)
(if (> b c)
(+ (* a a) (* b... |
You can set any size of the field and any number of bombs. I think I got a pretty flexible program again(Tic tac toe game for the console). What do you think about the code? I would like to know if I made mistakes in program design.
skeleton:
public class Minesweeper {
public static void play(){
final int H... |
Given multiple sorted integer vectors, the goal is to merge them into a single vector and eliminate duplicate values. We've already achieved some improvements over the most simple approaches, but overall the operation is still very expensive and we're not sure if we're missing something, there must be a way to perform ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.