instruction stringlengths 71 95.1k |
|---|
I've started to fill my GitHub profile with small applications to educate and showcase my skills. However, I feel like I'm missing something essential, while creating these projects.
Could you take a look at this component, and advice me on how to refactor it? Its purpose is to get Coin Data from an API, and display t... |
Code Review : Could promises be 'chained'?
I am developing a simple Quote tool for the business-owner to fill in a form (item number, item name, price, etc) and send to the potential customer.
This code review request is in reference to the "view-quote" page, which simply displays a quote that was previously sent. (see... |
I've become a bit rusty in Java. This is an attempt at brushing up my skills.
In computer science, merge sort is an efficient, general-purpose,
comparison-based sorting algorithm.
Questions
How can I improve my test cases? (TestNG)
I've used Java-11 here, can I use better idioms?
Can this implementation improved f... |
I've written some code in Excel VBA that does the following:
Finds a cell ("O") in a range (C3 to Z26)
Looks at an adjacent cell. This cell is located through "OFFSET_ROW"
and "OFFSET_COLUMN" (defined in a separate public variable) and contains a text string that is split into an array (using the "\" character as a de... |
I decided to redo a program that I did awhile ago that encodes text as an image.
For example, here's the entirety of clojure/core.clj, Clojure's standard library:
encode_text(clojure_core_text, int(5e4))
And here's the source for the program itself (with a lower multiplier to make it more blue):
It's interesting tha... |
For the Below code want to know whether the correct procedure is followed
for the java code , are there any missing points according to the java standards ?
import java.io.IOException;
import java.util.LinkedList;
import java.util.List;
public class CodeReviewTest {
volatile Integer totalAge = 0; ... |
I have created a Python 3 password manager for API keys and social media passwords on local storage. The script is 500 lines and PEP8/PYLINT compliant, each definition contains a docstring and the code is well commented. It is purposefully in "procedural" instead of "object" style.
The cryptography definitions all beg... |
Hangman game coded in Java (at a beginner's level) where Hangman.java can be run with one or more arguments.
Hangman.java:
package hangman;
import hangman.Game;
import hangman.Prompter;
public class Hangman {
public static String normalizeArgs(String[] array) {
String result = "";
switch (array.le... |
I am working on moving a save system from loose files to a (spatial sqlite) database.
The user places objects from a library in a 3d simulation. Scenarios are "what-ifs", what if we place 5 wind turbines over here, what if we placed 10 racks of solar panels instead etc. They are mutually exclusive within a "group".
Ite... |
I am trying to find a way to convert printable data types into a string in the fastest way possible.
I originally read that a static variable of stringstream that does all of the formatting is one of the fastest ways, since constantly constructing temporary variables of stringstream is slow.
The problem with using stri... |
I wrote code that takes the value of the progress bar in my Android app which influences what is displayed on the UI. If the user's progress bar value is above or below a certain number, data will be either displayed or not displayed. Here is the following code:
public class DetailsFirstTabFragment extends Fragment... |
i'm using an external API that posts products and orders into a marketplace, and it provides a class that in each request i have to specify an endpoint, user and password (token), it's something like this:
if($env == 'testing') {
$endpoint = 'testing';
$user = 'testing';
$pass = 'testing';
} else {
$end... |
I have a folder containing thousands of files and directories. I
would like to move all the files that are not contained in a sub
directory into a directory and name it the file name, while leaving
the files already inside of directories alone, ie:
create 'newdir' ; move 123.mp4 ; into 'newdir' ; change name '... |
I’ve just created Minesweeper game, which work perfectly fine (for me).
Any suggestions on how to improve this code would be greatly appreciate, in terms of:
Object-oriented
Array
Error handling
Function
More efficient approach
Others: Style(PEP8), comments, clean code, recursion, etc
Explanation of game:
Minesweepe... |
I wrote a utility class that has simple methods for:
En/decrypting data with 256-bit AES-GCM using a password
Generating RSA keypair
Saving RSA keypair and storing private key encrypted
En/decrypting data with RSA (data with AES-GCM & random key, key with RSA)
import javax.crypto.*;
import javax.crypto.spec.GCMParamet... |
Could you review my usart driver wrapper please?
It contains the C language Xilinx usart driver, but I write C++ programs and need to C++ usart driver. How it was designed correctly and what I have to chage or add in the one on your view?
I will be thankful for your the strictest appraisal.
Thank you.
//**************... |
I have tried going back to C++ after long time of mainly doing C#. I realize that the code is far from perfect, however I would really appreciate if someone could point of what exactly is wrong and how to fix it, so I can learn how things should be done. (just for code design, not asking to fix any logic errors)
What i... |
I've wrote a Sudoku-Solver in Java, which also contains a GUI, so you can just enter the Sudoku, press "OK" and it will solve the Sudoku using backtracking.
Here's the code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static javax.swing.Windo... |
Hello there and beforehand a huge thank you to everybody for dedicating their time to help others.
This is my first post here, so I hope I comply to the guidelines. Maybe a bit background to myself: I do not have a formal education in computer science except for some basic introductory level courses at university. I ha... |
I just started working on a little project to help me study for a course I'm taking.
Is there anything I can do to improve code readability / bad practices?
I had to remove most of the labels and buttons (due to stack-overflow posting rules) but I kept one of everything just so you can sus out how I programmed those f... |
I posted this answer recently. OP in the StackOverflow question mentioned that it was for educational use, but I can imagine it being used as a debugging aid. Then I decided to improve it slightly and make it a compile-time function. Code:
#include <cassert>
#include <iostream>
#include <string_view>
#include <type_tra... |
This is the problem:
You are given queries. Each query is of the form two integers described below:
1 x: Insert x in your data structure.
2 y: Delete one occurrence of y from your data structure, if present.
3 z: Check if any integer is present whose frequency is exactly z. If yes, print 1 else 0.
The queries ar... |
I was playing around with Unity's new Entity Component System and I was trying to implement a rotator system.
This is what I came up with:
Component Data:
using Unity.Burst;
using Unity.Collections;
using Unity.Entities;
using Unity.Jobs;
using Unity.Mathematics;
using Unity.Transforms;
[GenerateAuthoringComponent]
pu... |
I've written code that deletes a "post" the user has sent with my Android app. A "post" is made of an image (stored in Firestorage) named A, of a Firestore document named B which is the user UID (this document contains a field that is the sum of all the posts' number of likes), and of another Firestore document named C... |
I must access the elements of an object array very often by an identifier id, i.e.
[
{id:1, value:“test“, cat:2},
{id:2, value:“test“, cat:2},
{id:3, value:“test“, cat:2}, ...
]
To do so I use find, for example to fetch the value of object with id 3:
SomeVal = myArray.find(x => x.id === 3).value
However, as I would... |
I made this anti SQL Injection, I tested if I can still send queries, and it is looks good. could you tell me if you see any problem I missed, before I launch this to the internet? (this is contact us form, no log in)
<?php
if(isset($_POST['submit'])) {
$name = $_POST['username'];
$email = $_POST['email'];
... |
I wrote a simple application that uses some weather api.
It has got 2 options.
It can fetch current forecast or it can fetch forecast for some days ahead.
I have used ObjectMapper to map HttpResponse<JsonNode> to my customized model objects.
I have been struggled with improving method that creates query for given host ... |
here's my code for moving a square on a canvas. Basicly I'm creating this thinking of some simple simulations or maybe a simple game. Would love some feedback how to optimize the code.
const canvas = document.getElementById('canvas');
const ctx = canvas.getContext('2d');
class Map {
constructor (x, y,) {
... |
I want to create a backend for a simple REST API in OCaml. For this I use the libs httpaf and yojson. I have something that works but I would like some reviews.
Here is the structure of my little server:
bin/
| - backend.ml
| - lib.ml
| - dune
dune:
(executable
(name backend)
(libraries httpaf httpaf-lwt-uni... |
i am new with nodejs, and i am trying to ameliorate, not only my experience but the power of my code, so i would like to ask you today to give :
some way to optimise my code
note on 10 (?? / 10) for my code
and if there is any website where i can test my code, i ll be so grateful
so here is my nodejs class.
there is no... |
I created a monad in Haskell that lets you sample without replacement from user-defined urns, and then at the end gives you a list of all possible outcomes. It looks like it's similar to the list monad (except that one only ever samples with replacement), and to the ST monad. Here's the interface I want to present:
dat... |
From here:
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:
The solution set must not contain duplicate triplets.
This solution works and is pretty fast but not very memory efficient. I have some com... |
I created a program where I was constantly needing o know the number of files in a folder, number of folders, and getting these file names into a vector, so I made this wrapper because I am planning on creating a program that will as well constantly need the informations above mentioned.
mydirent.h
#ifndef MYDIRENT_H_I... |
I am new to Haskell and currently trying to port my solutions for the 2019 installment of the coding challenge AdventOfCode to Haskell. So, I would very much appreciate any suggestions how to make the code more readable and, in particular, more idiomatic.
This post shows my solution of day 6 part 2, but also includes t... |
I wrote a bunch of functions and macros for safer and simpler allocation. They are documented in their files.
Disclaimer:
The library requires POSIX extensions, GCC extensions, and LIBBSD extensions, but if someone wants to make it portable, it shouldn't be difficult to get rid of the extensions I used. But to me, th... |
My Approach
The code for the library project is all over the place, how would you code this project using object-oriented programming. For example, would you use
document.addEventListener()
and just set if statements for elements that are dynamically created?
Also, there is not a lot of comments in this code, I thou... |
I am trying to analyse my running data, which comes in gpx form, import and writing of data is working wonderfully.
Now I want to average the pace I calculated between two points overage a certain distance (for example 1000 m) and see the result as a list for each individual kilometer. If the kilometer is not finished... |
I have this code to open an outlook appointment item:
Public Sub OpenOutlookAppt()
Set myolApp = CreateObject("Outlook.Application")
Set objExpCal = Session.GetDefaultFolder(olFolderCalendar).GetExplorer
Set objNavMod = objExpCal.NavigationPane.Modules.GetNavigationModule(olModuleCalendar)
Set objNa... |
A while back I wrote a simple python script to to change the elementary icon theme, elm_icon, for Bodhi Linux. In elm_icon, the argument processing is done by simply parsing sys.argv. I decided just for educational value to rewrite the argument parsing part of the script using various argument processing python modules... |
For many years, there have been several JavaScript libraries for implementing custom events and event listeners. But, as MDN web docs suggests, there are now available constructable Event, CustomEvent and EventTarget objects. So, what would now be the standard approach to equip my custom class with event-emitting quali... |
The backend part has the following purposes.
An endpoint that takes a search term and returns a list of repositories.
An endpoint that allows bookmarking a repository by its id.
An endpoint to get all bookmarked repositories
An endpoint to remove a bookmark.
I have written the code for the application using NodeJS a... |
I have a basic python file editor/executor(still working on it) but I get know that this does not have the best performance so are there any sugestions about how to up the performance of this code:
import time
start = time.time()
from time import strftime
import sys
import log #package from os_sys
from os.path import *... |
What do you think about syntax of my strictly typed DSL snippet below? Does it look understandable and efficient to define object graphs at a first glance?
def Person(Name Name, Age Age)
def Name
(string First, string Last)
def Full = $"{First} ${Last}"
(string First, st... |
iOS: prettify random color for debugging
I used to use random color to debug, from colors I like
extension CALayer{
func debug(){
let colors = [UIColor.blue, UIColor.magenta, UIColor.red,
UIColor.green, UIColor.brown, UIColor.purple,
UIColor.cyan]
... |
I want to parse a date string with the following general format: Weekday, DD-Mon-YYYY HH:MM:SS. The calendar should also accept:
a date without the weekday
spaces instead of dashes
case-insensitive month (e.g., allow "Jan", "JAN" and "jAn")
two-digit year
a missing timezone
allow multiple spaces wherever a single spac... |
This is my first time ever making a game. It is a pong-like game, where the user has a paddle and has to prevent the ball from passing them. Since this is my first game, I want any recommendations/improvements/advice from more experienced people. The advice can range from simple Java errors I've missed to more game-dev... |
I am having performence issues with image processing task (flash light effect). I used c#, and used couple references (LockBits Method, Extension). The program has bad frame rates.
Edited the code, improvments were made but still doesn't match up to my expectations.
using System;
using System.Collections.Generic;
using... |
I've now tried to use the suggestions you can find here to improve my Sudoku-Solver.
Here's the updated code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import static javax.swing.WindowConstants.EXIT_ON_CLOSE;
public class SudokuSolver {
publ... |
I'm following this tutorial for setting up Django with Nginx and Gunicorn. One of the main components is the collecstatic command.
This is the code I used:
~/myprojectdir/manage.py collectstatic
and I replaced "myprojectdir" with the actual directory.
First I received this error:
django.core.exceptions.ImproperlyConf... |
I think I finally finished a small coin flip project I found online. However, I'm pretty confident this is far from the optimal solution and would really appreciate any feedback on how this could be improved. Since I'm studying by myself using Head First and Code Academy any feedback would be very very helpful!
The goa... |
I have 'n' microphones placed in square fashion and I want to make sure that all the channels must be aligned in time exactly the same if the signal is equidistant from all the 'n' microphones i.e. in the center of the square.
I have written this script to do the difference in zero crossing timings for only two signals... |
Task
You have an array of positive integers. Your task is to find an
integer x such that the following are true:
Bitwise AND between x and each array element is non-zero.
Number of ones in the binary expression of x is minimum.
If there are many such x, you should find smallest of them.
Input Format
The first line... |
Background:
I have a TCP online multiplayer game server, which the player requests to log-in. However, the game server does not handle the authentication part of the login process, instead, it uses an outer micro-service which is an HTTP server to see if the user can authenticate with the given credentials.
Now why is... |
I have followed a mysqli tutorial to create a login with cookies and session with remember me authentication in pdo.
in tutorial class had a new db_connection, I tried to inject my pdo connection in to class, same as in here: https://phpdelusions.net/pdo and read some answers in stackowerflow by Your Common Sence and d... |
So I have a piece a code that, altough it does what is expected, it doesn't seam very performant to me. I just wanted to know if there's a better way to do this or if my code is alright as it is.
The objective of the code is to recieve an image path, check if the image exists or if it isn't png, if the image isn't png ... |
Implementing signal slot mechanism again seems quite
dumb because there are so many people already done this
before but it is for learning and I intended some specific
goals.
I had some library in mind which is easy and safe to use and
relies on C++14 only. The possibility of member function
connection and disconnectio... |
Ⅰ Roman numerals are composed of digits taken from a small set of uppercase characters. Lowercase characters were first used in the Middle Ages.
$$I,V,X,L,C,D,M$$
With these digits we can represent numbers from 1 to 3999.
Ⅱ For the benefit of representing larger numbers, one extension adds an overline or Vinculum to t... |
I have made a ID generator class for my Repair Shop Software, that generates new ID for all data entities that are used in the software. It also converts int value of the ID to String value used for UI, and String values used for UI, to int value. I would like a general opinion on my IDGenerator class. Am I using some ... |
The program below takes inputs for the temperature in various cities in a span of multiple days. It then outputs the ones where the minimal temperature is closer to the average than the maximal temperature, prefaced by the number of cities where this happens.
For example:
"3 5
10 15 12 10 10
11 11 11 11 20
12 16 16 16... |
I recently made a boggle solver in Rust to compensate for the fact that I'm really bad at boggle. This has also been a good Rust learning experience. The code does what it's supposed to quite well but it is a bit slow, even when compiling with the -O flag. Since I'm new to Rust, I'm not sure where the slow spots could... |
This is my answer for
https://www.hackerrank.com/challenges/construct-the-array/problem
(Passes all the test cases)
Problem
Your goal is to find the number of ways to construct an array such
that consecutive positions contain different values.
Specifically, we
want to construct an array with \$n\$ elements such ... |
This is a wrap that queries the number of files and folder from a given directory, also list the folders and files into a vector. I have posted another wrap in this discussion that do the same things and following some really good suggestions I created another this time using filesystem.
The filesystem I used is this i... |
I have recently made a hangman game using python. This is the main bulk of the code, however, there are other files that I have writen that get the words from a dictionary, or see if a word repeats any letters.
import Pick_Word, Unique_Chars
word = (Pick_Word.get_word()).upper()
wordlist = list(word)
dict = dict(enumer... |
Here's the context: My code is meant to automate testing of OCR (Image to Text programs) for a science project which could easily be read and understood my others. The code includes sets of functions which serve different purposes. Basically, there are functions which deal with the drawing and saving of pages (drawtext... |
I have created class that uses SharedPreferences to store and retrieve application settings. Is it good idea to access SharedPreferences each time I need parameters? Will it drain system resources?
class MqttSettings
{
public static final String ADDRRESS ="address";
public static final String PORT ="port";
... |
I have something like a shop. It is limited to a checkout page, which will send an email. Nothing big, but a nice thing to learn more OOP.
Almost every time I develop new classes I am wondering how to organize the flow of depending methods. Here is an example, a first draft of what I have:
<?php
// Outside the class:
... |
I have just completed my first Ruby OOP project. Fairly simple but still a bit time consuming as I am still learning the language.
I would like feedback and ways I can improve on this and make the flow of code better or could have done something in a different way to save time or the "right way".
I thank you all in adv... |
The F# web-development framework Giraffe supports a functional style of Dependency Injection using a form of the Reader monad, as explained in this GitBook. I would like to use this pattern more generally, moving away from a service-locator pattern I use today in which my injection sites are coupled to the specific se... |
I have this method that creates book objects. I pass a list of strings (size 60000+) that contain the information of the book, the function then goes and extracts the information makes the book object and adds to a global list.
This solution works, but is not memory that efficient and slow due to the replacements and r... |
I'm creating a data set to be used for a machine learning application. To do this I use my webcam to record videos at 1 frame per minute and did this for a few days.
I then created a program to extract these frames (in gray scale) to create my data set and let it run over the weekend.
After I noticed that not all my v... |
Would like some feedback on a code style exercise motivated by this PythagTriple algorihtm. I started with the Rosetta Code - "efficient C" solution (not the naive one) and refactored it heavily into modern C++17.
It doesn't quite match their "Task spec". That that was not the focus. However, it could very easily be ... |
I'm parsing out specific values on web pages with BeautifulSoup. However, since I'm using RegEx, my program is taking forever to run. Would love ideas on how to speed this up.
from bs4 import BeautifulSoup
import datetime
import json
from progressbar import progressbar
import pdb
import pickle
import re
class Listi... |
The code below uses information saved in a hidden worksheet based on values from another sheet with a codename of GeneralInfo and is called when specific cells in GeneralInfo are changed. I think there would be a more efficient way to write this code. the Processing.Label refers to labels on a worksheet codename of P... |
I have implemented a QuadTree of my own, and I'm afraid I didn't use yield properly when I query my tree, my fear is that I create O(HN) iterators.
Could you direct me how to better improve the performance of the following code?
QuadTree
public IEnumerable<T> Query(string leafId, Circle shape)
{
// Gets the... |
I have created a blackjack game in Python3 but I am worried that it is not very efficient and also there are some problems with it.
Problem 1) The player almost always wins unless he goes bust as the program allows the player to take multiple cards but the computer only chooses 2 and I can't think of any solutions.
Pro... |
I want to design an elevator system, which has functionality for pressing button from outside of the elevator (Not selecting a direction - Only calls the passenger’s existing floor).
And also select floor functionality needed to select a floor for target.
Inside controls have priority over outside controls.
While trave... |
I just wanted to ask the following question. I have solved Kadanes algorithm using the recursive approach as shown below. The implementation works
public class Kadane {
public static void main(String[] args) {
int[] arr = {-2, -5, 6, -2, -3, 1, 5, -6};
Kadane k = new Kadane();
System.out.... |
While we patiently wait for ranges in C++20, it can still get somewhat frustrating to write begin(), end() and micro-lambdas to specify "sort order" and "field extraction".
It is the latter, "field extraction" which I find is very commonly needed, but rarely discussed. The C++11 lambda has made it easier but the synta... |
I'm working on a React app with websocket. In this app there is a socket event listener which returns 3 types: add, change, and remove. Certain state update operations will be performed based on the type received.
Do I properly mutate the users state? I'm not sure whether it follows the principle of React regarding upd... |
I have this piece of code that is used to export an Excel file using Laravel-Excel. But I have doubts about it for the long run. Can the server handle it if there are a hundred requests?
<?php
namespace App\Exports;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\Exportable;
use Maatwebs... |
I have implemented Binary search code for a given sorted array, written unit test too, Please review my BST unit test code and let me know your comments for improvements.
class BinarySearch {
public int binSearch(int[] sortedArray, int key) {
return search(0, sortedArray.length - 1, key, sortedArray);
}... |
#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
void nl(void) { //function to print new line
printf("\n");
}
int** allocate(_size) {
int** matrix=(int**)malloc(sizeof(int*)*_size);
for(int i=0;i<_size;i++) {
matrix[i]=(int*)malloc(sizeof(int)*_size);
}
return matrix;
}
void sc... |
I have this code to get the current timestamp so that I can save it as a part of the key in leveldb database.
export default function timestamp() {
var [seconds, nanoseconds] = process.hrtime()
return seconds * 1000000000 + nanoseconds
}
I am wondering are there any downsides to use this function. Or are there any... |
I created a small script for automating password store management and quickly searching and launching notes, shortcuts and documents through some keybindings that will execute the script.
Script is working fine, but would very much appreciate feedback from more experienced folks on how to improve. I thought about using... |
This my program to change the formatting of sheets in different folders. I have over 5000 files in one folder and it is taking up to three hrs for one folder and there are multiple subfolders in the main folder. I want to cut down this time to 10 mins or as fast as possible.
Sub loopAllSubFolderSelectStartDirectory()
... |
The Reason
The reason I designed this code was that in many cases, when I wanted to test code in the browser that would be running on a Node instance, the code that I was copying (Don't worry, copying my own code) was huge, around 2 thousand lines. The solution was to move parts of it that were identical across multipl... |
I am currently learning how to create nodejs express rest api using async making it fully scaleable and secure.
My goal is to ensure maximum functionality and speed, currently I am using MVC structure with route, controller, service and model.
Database is mysql and using mysql2 pool.
I am looking to know if the example... |
I've written my first ever Rust application, I'm looking for advice and criticism.
It is a very small application, using Tokio async, and is meant to be single threaded.
Mostly I'd like to know if I am writing idiomatic Rust.
The full source code can be found at https://github.com/arontsang/rust-doh-nut
fn main() -> Re... |
i'm currently trying to rewrite sql server newSequentialId() function in pure c# that is performing as fast as possible and eats minimum memory.
Question is can I it be done better - current benchamark shows it is at most 2x slower than native function used by SqlServer (p/invoke)?
using System;
using System.Buffers;
u... |
I want to save and load an arbitrary Java String in a Text node in a XML file using the Java DOM API.
The Transformer and the DocumentBuilder already escape and unescape predefined entities such as ", &, ', <, > and a few other characters by replacing them with with ", &, ', <, > and &#c;, where c ... |
I am solving an exercise. Essentially, it's a shell script that takes in file and/or directory arguments and outputs another (standalone) shell script that outputs these files, including any directory structure associated with them.
Example usage:
bundle.sh dir1 dir2 file1 file2 file3 >unpack.sh
This expects that bund... |
So for an side exercise on exercism I implemented a BinarySearchTree.
I was confident in implementing the creation of the binary tree. But I'm very unsure about the traversal of the tree. So I came up with two implementations of the traversal algorithm - which one is the "better" solution?
I'm learning about F# becaus... |
I had to write some code that receives a number 'x' and an alternately sorted array (an array with all even indexes sorted upwards and all odd indexes sorted downwards) and checks if 'x' exists in the array. If it exists, the method will return the index, if not, the method will return -1.
If there is more than one 'x... |
I'm trying to implement a regularization term for the loss function of a neural network.
from torch import nn
import torch
import numpy as np
reg_sig = torch.randn([32, 9, 5])
reg_adj = torch.randn([32, 9, 9, 4])
Maug = reg_adj.shape[0]
n_node = 9
n_bond_features = 4
n_atom_features = 5
SM_f = nn.Softmax(dim=2)
SM... |
Happy new year everyone, Following Andrew NG's course on coursera here's my implementation for the gradient descent algorithm(univariate linear regression) in Python using pandas, matplotlib with optional visualization which creates a GIF. Any optimizations/suggestions are welcome.
For those who don't know what gradien... |
I have watched Professor Sheep's Leetcode 140: Word Break II
YouTube video here
CPP code here
My own Python translation code is below. I am thinking that the code can be optimized by traversing from right to left in this case as the code only start working with the last word. I have submitted both implementation to lee... |
As a simple project to tackle during the holidays I've set to write a simple wrapper around Citymapper's api to familiarise with httr, testthat and a simple CI setup (on CircleCI).
The API mainly revolves around 2 things:
Cheking if a given point falls within their covered areas. As on their api docs there are 2 ver... |
I'm writing some Python code that will handle huge datasets.
On a small scale, this snippet works fine, but as the datasets become bigger it grinds my script to a halt (I know it is this part as I have surrounded all the possible offenders with timers, and this one takes the longest):
#example variables
neighbours = [1... |
I'm a 14year old and still learning.
I know everyone says "don't roll your own crypto", however I decided I must make my own cipher in javascript as soon as I have enough knowledge.
I started simple with simple ciphers like caesar and vigenère.
But then learned about binary-based ciphers.
I even created my mutation of ... |
Hello this is a Console App(.Net Core) in Visual Studio 2019 and i am trying to split a string into sentences and then add them into a dictionary with Key the first word of the sentence and Value the sentence itself.
I have the following code and i wonder if the way i did it has of course a better way to handle it.
usi... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.