instruction stringlengths 71 95.1k |
|---|
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... |
I built a Brainfuck interpreter. It seems to be working. I ran the game of life and this tic-tac-toe and other programs on it. They worked fine. I'd appreciate any comments on correctness, readability and performance improvements:
#include <algorithm>
#include <cassert>
#include <cstdlib>
#include <deque>
#include <fst... |
This is a Python program that takes data from Quandl Databases and formats it for my Neural Network to Train.
The code works but I'm not so confident in my code styling conventions. If you would like to review this code with any styling suggestions on how to reformat the code (with respect to PEP8), feel free to review... |
I'm not experienced with testing, therefore I'd like you to look at my code proposal of unit test. My solution has following projects
Tests\Application.Tests
Application
Domain
Infrastructure
Web
And I am not sure with Application Service Test. The tested class is DeliveryDateService
namespace Application.Services
{... |
Simple Console Application for checking if one of the hosts is available. The implementation should be for around 5 hosts to check with different response times and the method should return fast when one Host can be pinged. Is the asynchronous implementation O.K.?
using System;
using System.Net.NetworkInformation;
usi... |
I started to learn React, and I wrote simple Blackjack game. I just need code review because I don't know anyone who know React well.
Whole state and logic of my game I have in Game.js component:
import React, { Component } from 'react';
import Hand from './Hand';
import DealersHand from './DealersHand';
import Bet fro... |
Goals
learn Python
improve problem-solving skills
improve my coding style
Hardware
This code runs on a Raspberry Pi 3 Model B (Raspbian OS) in combination with the Sense HAT. The 8x8 LED-Matrix on the Sense HAT is used for displaying the game-graphics and the included joystick is used for steering the snake. While de... |
I've completed the following coderbyte question and would like feedback as to whether it follows Python best practices, is efficient and so forth.
The coderbyte problem:
Have the function calcpath(str) read the str parameter being passed, which will represent the movements made in a 5x5 grid of cells starting from the ... |
I've made this GUI program for my workplace that checks whether measured coordinates on machined components are within spec.
It takes in specified coordinates, tolerance and measured coordinates and uses Pythagoras to check whether the tolerance has been exceeded.
It then plots the measured point relative to the 'true ... |
This is a simple guessing game I have made, an improvised one. I will do a GUI version of this shortly.
I'm looking for comments and interesting code ideas.
import random
sec_no = random.randint(0, 10)
ncount = 0
att = 5
while True:
sec_no = random.randint(0, 10)
ncount = 0
att = 4
minp = input('''... |
I have a block of Jinja2 (used in Sceptre/CloudFormation). It is not readable in my opinion, but I can't find any way to clean it up to improve it.
{% set args = "--kubelet-extra-args '--node-labels=nodegroup=" + sceptre_user_data.node_group_name %}
{% if sceptre_user_data.node_labels != "None" %}
{% set args = arg... |
I created a Rock/Paper/Scissors game in C# that asks the player the number of rounds he wants to play, and then calculates the points and determines the winner.
Is there a way I can fix my code? Is it appropriate to use switch and if/else together?
Console.Write("How many rounds do you want to play ? : ");
int numberOf... |
I'm developing a Python library to consume the Zendesk search API.
Problem is, Zendesk limits search results to 1000 items. Thus in order to get all the results if they are greater than 1000 I need to call the endpoint several times with a recursive function storing the latest created datetime for a ticket once the 100... |
Description:
This would make a first part of a currency exchange simulator The first phase includes downloading currency historical data from histdata.com api, plotting given period and given time frames using different plot types and adding some forex technical indicators to the data. I will be posting follow ups when... |
I have a simple application which requires the user to input details about students and their grades. I have two different classes Student and Database. The Student class contains info about students, such as, their names and grades:
Student.h file:
#pragma once
#ifndef STUDENT_H
#define STUDENT_H
#include <string>
cl... |
[I made a little web-scraper that downloads the source html files as well. Now for the sake of saving storage space i wrote a small function to delete quite a bit of stuff in the html file (specific id's, classes and meta information as well as footers, headers, and links).
The function takes the html tree as input an... |
I am doing a practice project to create a calculator with OOP principles. Below is my CalculatorApp that communicates with Calculator(to calc integers) and StringParser(to tokenize input). For CalculatorApp to work, strict rules need to follow. For example, the input must use "add" not "plus" and "(" not any other kind... |
I am trying to solve this question: https://open.kattis.com/problems/fenwick
A Fenwick Tree (also known as a Binary Indexed Tree) is a data
structure on an array which enables fast ((log)) updates and
prefix sum queries on the underlying data.
For this problem, implement a Fenwick Tree to support operations of
t... |
I had to write a code (as an exercise) that receives a 2D row wise and col wise sorted array and an element, and return true is the element exists in the array.
The first thing that came to mind when i heard "sorted" is binary search, but than i realized that the last element in each row isn't necessarily smaller than ... |
I have implemented exponentiation with integer base and non-negative integer exponent for practicing purposes.
Of course there is some upper limit what numbers can be exponentiated within the int datatype, but I wasn't concerned about this at this point. But any suggestions how to handle it are welcome.
There are four ... |
I have a function where I am trying to assign book ids to certain students on registration of a new student.
FOR book_id IN
SELECT a.bookid
FROM books a
WHERE a.isdelete = false and published = true
LOOP
IF NOT EXISTS (select 1 from studentbooks where bookid = book_id and studentid = id) THEN
INSERT ... |
So, I tried to solve this question and my code did not execute within time-limits.
https://www.hackerrank.com/challenges/acm-icpc-team
Here's my code,
from itertools import combinations
nm =input().split()
n = int(nm[0])
m = int(nm[1])
mat=[]
z=[]
for i in range(n):
mat.append(input())
a=combinations(range(1,n+1)... |
I have a List of Objects containing following structure
public class DaySpan{
private LocalDate date;
private Integer numberOfDays;
..
..
//getters & setters
}
Lets say the list contains 3 instances of above classes with data (date is in dd/mm/yyyy)
04/02/2020 3
03/02/2020 5
01/02/2020 1
Then I need ouput for coun... |
I am working on a Units library for a personal project that is a physics-heavy C#/Unity3D game, and I am looking to improve it in a few areas:
Is there a way to reduce the code duplication?
Is performance going to be a problem? Is there anything I can do to improve performance?
Can I hide the value member variable s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.