instruction stringlengths 71 71.9k |
|---|
As part of my own C++11 learning exercise I have implemented this Blocking Queue using the new C++11 thread API. One of the aspects I would like to improve is efficiency i.e. in the take member function while returning the Job template type to be returned by reference instead of by value.
/*
* blockingqueue.h
*
* C... |
I just started learning Haskell and this is my first big project (ie not factorials, fibonacci or graphers). This is kind of a gift for somebody so the language is a bit different. The program works, but I felt that some parts of the code could be improved, specifically:
Is Vector the best choice for representing curr... |
I am making a responsive horizontal scroll UI. The horizontal scroll position is calculated according to the mouse horizontal position:
$(document).ready(function() {
var docWidth = $('body').width(),
slidesWidth = $('#imgs').width(),
rangeX = slidesWidth - docWidth,
$images = $('#imgs');
$(window).o... |
I was trying to write a code from scratch for Chi-square test.This is the code that I had written in python using pandas.I had a doubt whether the code can produce the desired output or can be written in a more compacted way.
import pandas as pd
from scipy import chisqprob
from scipy import stats
def chi_square_of_df_... |
I am trying to write industry standard code.
https://www.quora.com/How-do-I-follow-a-user-on-Spoj-for-solving-problems-Refer-Details
Someone gave me this A2A.
And I wrote this code for it
//compile with g++ -std=c++11
#include <bits/stdc++.h>
using namespace std;
struct PROBLEM
{
string name;
string links;
... |
I'm trying to transition myself from my old coding-style (if-else, for.. in) to functional programming. I've tried to update the following code:
Old
class test {
childrenCount(group) {
let childCount = 0;
let excluded = ['html'];
let iterable = group.children || group;
for (let key ... |
I've written a "simple" interpreter for a programming language in Python, called Tellurium (named after the element of the same name). So far, it's working pretty well, but there are some things I'd like to fix/remove.
Tellurium is a tape-based language, so it uses a tape to store data.
import string, sys, random, time... |
It's using four sections of code block, I just want it to be reduced to one contiguous set that does either a or b with the two sections not a copy/pasted approach as done here:
public function process_bulk_action() {
//Detect when a bulk action is being triggered...
if ( 'delete' === $this->current_action(... |
It chooses for each chunk some points inside that chunk that work as the center of each island. Then for each tile on the map it calculates the distance from the points in the 9 chunks around the tile's chunk and subtracts the value from a Perlin noise (as described here).
The "problem" came when trying to reduce the t... |
Sometime ago I asked a question regarding a slow Filtering method for my DataGrid. Months later and I have a relatively quick method, though I am still looking to improve performance, especially when the user is deleting text from the SearchBox as this seems to slow down more than if the user is typing characters in.
O... |
I realized I had just created two classes that were virtually identical for simply saving objects to their own json files, so I've attempted to make it more generic. My only noticeable problem is because I am using gson to serialize / deserialize, that requires an explicit class type, which gets squashed if I use the g... |
Below is my implementation of a generic linked list in swift. Unfortunately, Swift playgrounds won't run until the compiler is totally happy - often, that involves clang making me explicitly unwrap some optionals. I just want a general idea of how to restructure my code to avoid unwrapping optionals and to make more us... |
I recently started Learning COBOL from Lynda and this is my code for the first challenge .
The Objective is that the user will provide the radius and we have to calculate the Circumference and the area of the circle and then display it.
Here is the Code.
IDENTIFICATION DIVISION.
PROGRAM-ID. CIRCUMFERENCE AS "... |
The following Macro sorts through a worksheet, copying and removing lines based on what appears in column A. If ("A" & i) is not a number, it triggers and moves the data to the appropriate place. The script at the moment is very slow, however. Is there an easier way to achieve this?
Sub FixAbstracts()
Application.Scree... |
Recently, I encountered this coding exercise on codility and the idea is
A zero-indexed array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is also moved to the first place.
For example, the rotation of array A = [3, ... |
I'm learning Clojure, and decided to write a Conway's Game of Life clone as my starting project. I ended up dicking around for a bit before diving in, and came up with a few functions that I'd like looked over. Mainly, I'm concerned about writing them more concisely and idiomatically.
I'm planning on using a 1D vector... |
I am learning Ruby and would like to know how I am doing as far as writing the actual code.
Please keep in mind that this is my first Ruby script program, but I am trying to learn ruby in a very short period of time.
I would like to know about nitpicks in the language that every Ruby writer should now, nuances in syn... |
Problem Statement:
Write a program that will convert a binary number, represented as a
string (e.g. '101010'), to its decimal equivalent using first
principles
Implement binary to decimal conversion. Given a binary input string,
your program should produce a decimal output. The program should
handle invalid in... |
This is code which must run on XP, so no GetTickCount64, and which should correctly handle the value wrapping around after 49 days. Can it be improved?
// DWORD timeoutMs is a given parameter.
DWORD beginMs = (timeoutMs == INFINITE ? 0 : ::GetTickCount());
DWORD endMs = beginMs + timeoutMs; // unsigned arithmethic is ... |
JSON is quickly becoming the formatting standard of choice for quick, convenient, and reliable machine to machine communications. It is flexible and widely supported but it has some drawbacks when it comes to data payloads like those from databases. A JSON payload from a database table named fruits might look like this... |
I've created a simple little file archiver that will run through a given directory and extract your files into an archive folder. It's pretty cool if I do so say myself, I would like some critique on what I've done, and some ideas on how I could better this program, better syntax, easier ways to do this, etc..
using Sy... |
The problem:
You are given a list of cities. Each direct connection between two
cities has its transportation cost (an integer bigger than 0). The
goal is to find the paths of minimum cost between pairs of cities.
Assume that the cost of each path (which is the sum of costs of all
direct connections belonging to this ... |
I am refactoring a legacy codebase to use spring. I am newish to spring and was wondering if you have any suggestions for the following code I refactored. Specifically about providing the ExpeditionEntitiesService.
Here is a REST service which uploads a file:
public class myRestService {
@POST
public Response... |
I have the following code where I need to execute 2 Linq-to-SQL statements. If I do not have the Any() in the if statement, then I receive error when the result is no data. However, I am not sure if my approach is efficient enough. Do you have any suggestions?
My goal is to achieve the following with single Linq statem... |
I've made two symmetric methods which serialize an int array of any number of dimensions into an OutputStream, and read such an array from an InputStream. I was wondering if there is ways this code could be improved. (I have tested this code and it works correctly.) Thanks!
import java.io.ByteArrayInputStream;
import j... |
I'm creating a game and I need some properties to work as percent chance to hit/dodge. I implemented a small testing program that takes percent chance and the amount of hitting attempts as input and outputs the successful hits, failed hits, and overall success rate.
My game will have decimal percents (1.5, 54.8..) The ... |
I have coded a program to scrape YouTube data (for educational purposes). When the link of the channel is entered it scrapes the channel name, description of the channel, the videos posted by the channel, number of views and links to those videos.
But I hardly managed to make these things work. I am not sure it is the ... |
I made a small script for Unity3D, meant to be use as GameComponent for GameObjects. It is supposed to represent values that have a max value, and an actual value. In games that would be the case, for instance, for the Health Points, the Stamina, Magic Points and so on. I would love to hear your feedback.
/////////////... |
My history of C/ASM locks here in codereview:
Simple spinlock for C using ASM
Simple spinlock for C using ASM, revision #1 (basis for this approach. If this one fails, then so will the one below.)
Once you have gotten taste of assembly, there is no turning back. I don't care if I
am not ready/worthy, I going to step... |
I am currently working on my YR9 (I'm 14) IST web development project and I want to know some tricks for optimizing my website.
I know that I shouldn't have the same CSS rules in the style tag on every page (something I will fix), but my JavaScript seems to have a slow response on the "gallery" page.
http://htmlforscho... |
Considering the lack of general purpose library to manipulate trees (not to mention zipper ones), I may end up packaging this piece of code, so I would like it to be reviewed first.
Any comment is welcome, notably on the following points:
the use of Map within the Tree data type (e.g. versus HashMap or bare lists)
the... |
I'm trying to make a small shooter game, where you can only see a small portion of the map around you. The map will also be much larger then the actual JPanel (The panel is 1000 by 1000, the map currently is 5000 by 5000).
When I added movement, the game seemed to lag slightly, mainly noticeable in the graphics flicker... |
This is part 2 of the game I am building. After some good feedback on my first post I decided it was time to post my updated code.
The differences in this part are: Updated code after feedback, new dodge mechanic and better formatted code.
What I am looking for are: performance feedback, code style feedback, things I c... |
I need to use elasticsearch in my node.js project, whose API looks like the following:
var elasticsearch = require('elasticsearch');
return new elasticsearch.Client({
host: 'localhost:9200',
log: 'trace'
}));
However, my elasticsearch host is stored in zookeeper, so I first need to fetch it before returning the cl... |
I have tried to implement a smart copy in C# for Windows CE, my version is somehow not performing better that the File.Copy method it's almost the same performance. Is there a way to make it more efficient?
public class SmartCopy : IDisposable
{
private List<CopyEntry> _entries = new List<CopyEntry>();
... |
I got a programming puzzle described as follows:
Save Beta Rabbit
Oh no! The mad Professor Boolean has trapped Beta Rabbit in an NxN
grid of rooms. In the center of each room (except for the top left
room) is a hungry zombie. In order to be freed, and to avoid being
eaten, Beta Rabbit must move through this grid... |
I was trying to fill a file with about ten million random characters (a-z,A-Z,' '). To my surprise the code is extremely slow. I inserted this print i to observe the progress. It was so slow that I just left the program running and went out. After about more than three hours it is still at five millions.
How can I mak... |
This is code for a Rock-Paper-Scissors game I made using some of the OOP concepts I learned in C#. I don't know if I am making the right choices but I am fairly confident. It would be great if I could receive guidance here.
I chose to have a Player and Computer class inheriting from an abstract Participant class. Every... |
I was in need of a method to dynamically generate a week range, so that the view reads something like "Week of May 16 - 22" and updates automatically. Here's the helper method I came up with, but I'm wondering if there's a more efficient way to have gone about this.
Dashboards Helper:
def week_range
today = DateTime.... |
I am currently working on a Universal Windows Platform App. It involves using a flipView to display a certain number of pictures in the user's picture library e.g less than 100 to avoid performance overhead. The code is displayed below :
// The constructor of my view model
public PictureViewModel()
{
... |
I've created a class that implements customized addition, subtraction, etc. But for this class I'd like to have some additional parameters for these methods (__add__, ...).
So my first thought was: A global dictionary that can be set or altered before I do the operations and internally it just accesses this dictionary ... |
I coded this simple protocol but I'm sure that it can be better, this is the process:
Reads incoming data
Waits until payload size can be read
Reads the full message
Checks if there are mixed messages
Reads incoming data again
Code:
private async void ReadPackets(StreamSocket socket, SocketInformation socketInformati... |
An aisle is defined as two rows of six stalls each. A stall is adjacent to another if it is directly next to it or across from it. My method finds out how many stalls can be found in a chain from the stall currently being worked with that are available for use. For example, * is a stall that is already occupied, and... |
I'm writing these pieces of code to parse expressions in the context of a dice rolling application for DnD. It's pretty much my first try using TypeScript and I'm not that good in Javascript. It is also the first time I write a syntax tree.
It's been tested using the Jasmine framework.
I'll split the question in two b... |
I'm doing this HackerRank problem:
Given \$N\$ integers, count the number of pairs of integers whose difference is \$K\$.
So far, I've ended up with this code:
def countPairs(ar, n, k):
ar.sort()
temp = list(ar)
i = 0
j = n - 1
cnt = 0
while i < n:
while abs(ar[i] - temp[j]) > k and j ... |
I am tasked with creating a list with no duplicates of all String elements, in this case first names, of an ArrayList. The method is passed a threshold, and the method must store the first name if it has occurred at least the amount of the threshold. The restriction is that I am only allowed to use the List ADT. I have... |
I am working on a large project that requires information about the monitor(s). Please don't be confused by the organization of the following structs. The design intent is to be cross-platform, so they don't contain any operating system-dependent types. Currently, I am working on the Windows implementation of the follo... |
Problem Statement:
Write a program that converts a number to a string, the contents of
which depends on the number's prime factors.
If the number contains 3 as a prime factor, output 'Pling'.
If the number contains 5 as a prime factor, output 'Plang'.
If the number contains 7 as a prime factor, output 'Plong'.
If t... |
Introduction: I'm creating a form using bootstrap and I have different input groups with the same structure and functionality.
All of them have a '-' button on the left and a '+' button on the right of the input field and, when one of them is pressed, the input value has to change.
Problem: As the buttons are inside a ... |
I'm working on a game engine among other things in Java, and would like to know how to optimise my code, as it is ridiculously ugly and bloated. I'm terrible with operating the java.util.File and need my code to be reviewed by others.
In essence, I have a folder hierarchy setup in the following manner:
Custom folder w... |
I have created a class to try, catch and retry N times. My class also supports retrying asynchronously. I'm wondering if there are better ways to implement this. I'm most concerned with the HandleException and RetryLoop methods, but also about the design of the class as a whole. TryRetry GitHub
/// <summary>
/// Class ... |
//This program generates a maximum possible palindrome from of a string num 's', of length 'n', by switching only 'k' digits.
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static void main(String[] args) {
Scanner sc... |
I've made this developer-tool for my own use. Perhaps for colleagues too.
Currently I'm thinking about enhancing it. So that different data-types could be chosen.
But before that I like it to be reviewed.
Therefore: Any hints and suggestions concerning algorithm, design, user-interface, whatever welcomed.
var text... |
I use the following code that is working as expected and I want to get some feedback from the community how I can Improve it...
The code does the following:
Get Some request with specific action to run which is describe in JSON file
e.g. URL is like aaa/bbb/invokeFn
Find this invokeFn in the config.json and call to ... |
This is a simple ToDoApp with a CLI that is made useful by adding persistence. A shout out to @Phrancis and @syb0rg for guiding this little project to where it is now.
The structure is rather simple. The basic class is ToDoItem. It is stored in an implementation of the interface ToDoRepository - in InMemoryToDoReposito... |
As tim suggested, some changes to the database was necessary. I have posed an improved version of this question at Get title from database based on member country.
I have the following database:
Each member may have multiple countries (1:n) mapped in table country2memb. It's even possible that one member gets the sam... |
i've node app that having the main function server.js(entry point)
Following is the server.js file code
var childModule = require("./controller/childModule");
var server = http.createServer(app);
var proxy= require('./controller/proxy');
var proc = require('./controller/runIntProcess');
var extLoader = require("./contr... |
I asked this question before. However, I realized that I had to edit some of my code after I got good answers. Therefore, I'm asking a new question here.
I have the following database:
Each member may have multiple addresses (1:n) stored in table address. It's possible that one member has multiple addresses within on... |
I am working on a program which manages a list, and must be able to insert new items, and delete ranges of items. I want the user to be able to specify the insertions and deletions in terms of the current state of the list, and not have to worry about how later operations will need an offset index in order to work on t... |
The program consists of 3 files: demo.c, mylib.c and mylib.h. The code is heavily commented.
demo.c:
/***********************************************************************
*
* This is a program that prompts the user for an input string using a
* custom input function.
*
******************************************... |
This is a small program to calculate the CRC for an STM32 program image, compatible with the CRC on the STM32 hardware. It's a word-wise CRC, and the bin file is encoded as a series of 32 bit little endian words.
This is my first serious attempt at Rust and I'm looking for general comments, as well as a few questions:
... |
As homework I had to implement many sorting algorithms including radix sort in Java. The task is to sort doubles in the range [0-1) that are rounded to the 10th decimal point.
I thought of 2 ways on doing radix sort, one using counting sort and another one using buckets. They both work but they are extremely slow compa... |
My code works and does what it is supposed to. However it needs to be more efficient. Could anyone help me tidy this up and show me where I could perhaps not rely on large loops (which it does a lot and slows it down).
import java.util.ArrayList;
public class PigLatin {
public String translate(String str) {
fin... |
The implementation below works, but I'm wondering if there's a modern C++ alternative.
For example:
Should I replace the raw new with a braced initializer?
Should I replace the Node* with a shared_ptr?
Let me know if you see any other things I could improve. I know I could also use a class, but I'd like to understand... |
Most hangman implementations I have seen keep a list of characters the player has already guessed and compares them to the players current guess each time to see if they have already made the same guess. My implementation checks if the word was changed after replacing any matches. Is my implementation easier to under... |
I've just finished work on my guessing game. I'm still fairly new to Python, so I'm looking for feedback and criticism on the code.
def game():
import random #imports the module 'random'
yes={"Yes","Y","yes","y"} #set 'yes' to these 4 strings
no={"No","N","no","n"} #set 'no' to these 4 strings
name=i... |
I'm relatively new to Python 3, especially IO programming, writing a Blender add-on to import model data.
The model data is available in a custom compression, and I originally wrote code in C# to decompress it in memory, porting it to Python 3.
However, being a little unsure about the "optimal" usage of IO classes and ... |
I've tried everything to make my program faster but with 250 nodes my code takes around 9 seconds to print the result, and with 5000 nodes it took around 260 seconds.
Is there a way to make my program faster?
I took the BFS function from here.
The site(connections) should consist of three towns each of which is connec... |
The post is follow up to my previous Typelist with extractor. The type_list and extraction feature code is identical to the accepted answer (from user2296177). The idea is to provide a type list with fundamental features that users could built something specialized upon that.
List of features, by order of appearance in... |
How can I optimize this?
#include <iostream>
using namespace std;
bool isprime(long nur);
void printAll();
long primes[10000000];
long primeCount = 0;
int main() {
long limit;
cout << "Enter the limit ";
cin >> limit;
for (long nur=2; nur<= limit; nur++)
{
if (isprime(nur)==true)
... |
I've tried looking some stuff up. I thought it was transposition first, but looking at this, that's not exactly it.
I hacked this code together in about 3 hours, stopping frequently due to frustration and I'm pretty sure there's some bad practices in there, I'm just too glad right now I actually got it to work. If anyo... |
Surprisingly, this question has no satisfactory answer. A safe usage of a LockCloseable would be like
try (LockCloseable lockCloseable = LockCloseable.lock(lock)) {
doSomethingUnderLock();
} // automatic release
or using @lombok.Cleanup
{
@Cleanup LockCloseable lockCloseable = LockCloseable.lock(lock)
doSo... |
I have written a wrapper for my code that allows basic namespacing and I'd like some feedback on how it can be improved.
It is designed so that a module can define it's namespace and get access to all of the parent namespaces. These are spread in reverse order across the arguments of the module (i.e. first.second.third... |
I have implemented a metaclass in Python 3 that, apart from the usual instance constructor (i.e. __init__), enables you to define a class constructor (as a class method that I called __init_class__). The metaclass extends abc.ABCMeta so it supports abstract classes, i.e. the class constructor is not called if a class i... |
I have written a simple wrapper for a 2D grid in JavaScript that allows me to resize the grid dynamically and I'd like to know if there's any way I can improve on my code.
Here is the code itself:
function Grid(width, height, defaultValue) {
width = Math.max(0, width);
height = Math.max(0, height);
Object.define... |
In an effort to keep all of the Google Maps Javascript API in it's own little world, I have created a googleMaps object that will contain all of the functions that directly make google maps webservice calls. This object will be imported once on every page. For now, it only has one function.
if (googleMaps === undefin... |
I am about to start a small/medium sized project. I am by no means a software architect. But I tend to question every move I make at times, since I want to do things correct.
I found a way to implement a simple repository, and I wanted to know if this is a "correct" way of doing it. I came to this solution, since I kno... |
Trying to figure out how to efficiently cache property calculations with dependency tracking to invalidate the cache. Here is the syntax I have at the moment (one Cache instance supports multiple object properties):
class Multiplication
{
public int Arg1 { get; set; }
public int Arg2 { get; set; }
public in... |
I think many here are familiar with the graph data structure. Not very long ago, I implemented as an exercise a supposedly simple Graph application that does some traversals. To note, the most complex operations in this class are those that exhaustively find Paths: findDirectPaths, findPathsWithMaximumDistance, and fin... |
I am not very experienced in PHP OOP. Moreover, when MySQLi comes with PHP OOP, it makes me more confused about using it in the most efficient way.
Connection class:
<?php
//connectionclass.php
class connection{
public $conn;
public $warn;
public $err;
function __construct(){
$this->connect();
}
private function co... |
This application is designed to query an active directory, and at the moment, performs only two tasks:
Save a list of all users to a file.
Save a list of all groups that all users are in to a file.
I tried to implement a print all groups method, but ended up removing it. I believe I removed all references to it from ... |
I am playing a bit with vanilla JavaScript and created a simple JavaScript calculator using eval(). Any suggestions for improvements?
var keys = document.getElementsByClassName('number'),
getTotal = document.getElementById('showTotal'),
btnReset = document.getElementById('reset'),
visor = document.getEleme... |
background:
I have a model called FileInfo, which represents a sftp file / windows dfs file.
class FileInfo(object):
def __init__(self, server_info, folder_path, file_name):
self.server_info = server_info
self.folder_path = folder_path
self.file_name = file_name
def get_file_full_path... |
I have two collections that I want to retrieve from the database and associate with each other. My solution works, however I know it isn't the most elegant one. Do you have any suggestions on how to improve the algorithm?
Classes:
public class JobAnnouncement : IDbEntity
{
public int Id { get; set; }
public Jo... |
Note: Yes. It's big. I'm not expecting commensurately
long/detailed answers (though if anyone wants to write one, you'll definitely be receiving a substantial bounty). This class is going to be used a lot in my
VBA development so any reviews at all would be immensely helpful.
Even if it's just a typo somewhere o... |
Recently I used this pattern to create a list of properties, each property having a varying number of arguments.
The properties list can be made at compile time, it does not need to change at runtime.
I tried to code this in a way such that it was easy for me to edit to add in additional properties (i.e., easy to add ... |
A few days ago I posted a little program that would check for vowels within a given word. I have rewritten this program, it can only find vowels in the English language still but, it will now tell you each vowel that is contained in your word, along with a count of how many vowels there are total, it's still not very e... |
I was asked to provide a codebase for the following exercise. I have provided the requirement of the problem and also putting down the code of two main classes. Can you please review and provide your input on improvement and also point out any issue or general feedback?
Java Service capable of posting GitHub events to ... |
I have the following switch:
switch (triggerTypeId) {
case Dom.Survey.TriggerType.CandidateContract:
list.Add(Dom.Survey.Rule.SendThisQuestion.Id);
break;
case Dom.Survey.TriggerType.CandidateContractEnd:
list.Add(Dom.Survey.Rule.SendThisQuestion.Id);
break;
case Dom.Survey.TriggerType.CandidateHours:... |
I use the the View below to get things started. I'm not interested in Marionette.
This code is what is constructed when the application first loads. It in turn loads the composite view which is common to all loads. It also constructs other objects needed for the application.
I'm looking for feedback on code structure... |
I asked this question on Stackoverflow, and was told I might have better luck here.
I'm new to c# and have created a basic file archiver. It works, and it does what it's suppose to do, but I think it's pretty slow. I added a simple benchmark in order to test the speed and ran it five times.
50.7120707 seconds
46.5686... |
I'm picking up Go, and wrote this simple script to parse a two csv files (spending.csv and savings.csv) to plot savings rate graph.
I would like to hear some generic comments on code readability, libraries I missed out on using, and Go-ness of the code I wrote.
I also used global variable months which I am not very ha... |
The task
A palindromic number reads the same both ways. The largest palindrome
made from the product of two 2-digit numbers is 9009 = 91 × 99.
Find the largest palindrome made from the product of two 3-digit
numbers.
This problem has been reviewed numerous times on this site, and many extraordinary clever solutio... |
For some post-processing, I need to flatten a structure like this
{'foo': {
'cat': {'name': 'Hodor', 'age': 7},
'dog': {'name': 'Mordor', 'age': 5}},
'bar': { 'rat': {'name': 'Izidor', 'age': 3}}
}
Each bottom entries will appear as a row on the output. The heading keys will appear each row, f... |
I'm sure it's still not yet perfect and tips will be greatly appreciated!
I just re-read the script and I realised I'm not handling exceptions! The script is unfinished but I'm looking for WIP (work in progress) feedback to shape the direction I continue. You can avoid commenting on the lack of exception handling.
I'd ... |
I've got a barebones C++ graph class implemented as an adjacency list. The graph consists of a vector of vertices. Each vertex has a vector of outgoing edges that store the destination vertex id. Vertex ids are just 'int's, incremented each time a new vertex is added to the graph.
This code is mostly for practice as... |
I was writing a program for my math class because my Professor asked me to. The problem is as follows: 300 people are arranged in 30 rows each of 10 people. The tallest of each row is chosen, and the shortest of each column. The problem is to prove whether the shortest of the taller people is taller, or the tallest of ... |
I need some help to refactor the script. I have a script which matches the buy and sell trades based on FIFO order.
The initial dataframe looks like this:
AsxCode Order.Type Trade.Date Price Quantity match_status match_vol
DMP Buy 17/08/2015 42.1179 105
DMP Sell ... |
I'm looking for optimizations and/or improvements. The code's flagship method read takes qty,item in the form of an array of arrays.
pluralizer.read([[2,'orange'],[3,'peach'],[5,'cherry']])
returns string
2 oranges, 3 peaches, and 5 cherries
GitHub
//Revealing Module Pattern (Public & Private) w Public Namespace 'p... |
Codeforces #230B
Question
Whether a number has exactly three factors. (i.e. 1, itself and its square root, thus squares of primes) [Time limit is 2 sec, Memory 256 MB]
Input
Number of testcases, n (~105) then numbers (~1012)
Output
Yes or No
Problem
I first check if it is a perfect square, then check if it's root is pr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.