instruction stringlengths 71 95.1k |
|---|
Below is a peak/valley detection algorithm I've designed. The basic premises for this function is that we split our data into chunks, do linear regressions on these chunks, detrend the data based on the line of best fit, points above a certain standard deviation are noted. Chunks are determined with a specified amount ... |
Description
What this does is it takes a randomly generated 64x64 stack and checks
for overlap within the 64x64 array. Here is an example:
https://i.stack.imgur.com/w6FVO.jpg. Each color is its own number (0 is
black, 1 is yellow, 2 is red, etc.) If the colors overlap, the
colors array will place a zero for th... |
I've written a function that moves selected items from a list into a new position. I've found that in order to do this, I need to retain the original 'index structure' of the array. The way I've done this is, instead of splicing the array right away, I set the elements to null, then later traverse the list backwards an... |
I have a scheduled task where I synch all the data from one table (via an API) to another. There are about 10,000 rows that are being updated and the new ones get created. This is what I came up with and for some reason, it is extremely slow.
def sync_data_from_hub():
stats = tasks.sync_clients_from_hub()
retu... |
This code is asp.net core middleware written in f# and called from c# for a blazor server-side app. How can this be made more efficient if any in regards to the async code.
F#:
type CheckMaintenanceStatusMiddleWare(next : RequestDelegate) =
let _next = next
member this.InvokeAsync(context : HttpContext) =
... |
Here is the React Native code to optimize: it's an OTP form. I want it to be as small as possible.
/* eslint-disable react-native/no-inline-styles */
import React, {Component, createRef} from 'react';
import {Input, Button} from 'react-native-ui-kitten';
import {View, StyleSheet, Image, Dimensions, Text} from 'react-na... |
I am solving this problem: Fraudulent Activity Notifications on HackerRank. I am done with my code and is working, but it is inefficient as well for very large inputs.
I don't know but after all my efforts, I am able to give out good solution to a problem of a MEDIUM LEVEL but this timeout error happens every time fo... |
I wrote three Flask views below.
First view
input stock code
Second view
get the stock details (name, price) of the stock by using 3rd party api
get the balance cash of DB and show to the view after calculating available number of stock by computing stock price and cash balance
and user input positive number of stoc... |
I wrote an extension to create a string-representation by an object:
public static string ToString<T>(this T @this, Func<T, string> predicate) where T: class
{
return predicate(@this);
}
So I can do something like
return handler.GetUserById(id)?.ToString(x => $"{x.LastName}, {x.FirstName}");
which gives me eithe... |
This is a class representing a city in a mod I am creating for Minecraft. All the constructor parameters are mandatory and they are used to help the class that calculates and builds the Paths, Buildings etc.
The City class has all the fields that are listed in the constructor including a 2D array that is a representat... |
Problem
Given two matrices: a pattern p and a text t. Write a program that
counts the number of occurrences of p in t.
Input
the first line contains two numbers
x and
y -- the number of rows and columns in a pattern. Each of the next
x lines contains a string of length
y. The following lines contain ... |
I wrote a program which creates a svg-group that contains several arranged rectangles with passages inbetween to reach all of the rectangles inside of an area selected by the user. Each rectangle should get an Id.
The user can input several things like rectangle-width/height and a number which represents the ID of the ... |
I am a C# game developer currently learning C++ and this is my second big-ish project (the first one being a vector implementation).
This time I opted for implementing a mot-a-mot any implementation based on the specifications of the ISO/IEC N4830 standard draft.
My objective is to familiarize myself with the modern C+... |
I made a random-walk predator-prey simulation that focuses on individual animals instead of the (maybe) more common array-based approach. I'd like to hear your opinion about this: how could the concept and the code structure be improved, and how good is my implementation?
Rules in the model:
There are two species com... |
In an application that I built recently, I needed to persist several variables, without loosing their state, for duration that the application was in use. After some research, I found this post on StackOverflow that led me in the right direction and from there I encapsulated that logic into a class.
I have tested this... |
Labelling Traversable containers is an ancient and honorable test of skill. My task here is to create a generic labelling mechanism for a Bitraversable, such as a tuple, or a graph with vertex and edge labels.
bilabelWith
:: Bitraversable t
=> (l -> indexl -> l') -> (r -> indexr -> r')
-> Stream indexl ... |
I have created a clock divider that works as follows:
If the division factor is 0, pass the clock through unchanged.
Otherwise, flip the output clock signal after the specified number of input clock cycles has passed.
I am relatively new to hardware design, so I would like advice on general best practices that I may ... |
I was fed up with the default alarm clock when doing laundry. The washing machine is in the basement and takes different time depending on the choosen program. The stopwatch has to be configured for every use and can run only one instance (we also have a tumble dryer). The alarm itself is only for fixed times, not for ... |
I have implemented a class to abstract the process of building a shader program in OpenGL (For now it does not deal with uniforms).
I would like some feedback on the coding style, and more specifically the structure. I have implemented a bunch of small and private methods in the class to handle various aspects of compi... |
This is my first attempt at OOP/classes: a game where you will select a character and use attacks and abilities to defeat the enemy character.
I have a few specific questions:
I was told that having the "while" statement in the Character doesn't make any sense but I don't know where I should put those.
Also, notable ri... |
How can I test a class that Swizzles? In particular, I want to test the following:
let bundleName = "Bundle.bundle"
var downloadedBundlePath: String? = Bundle.main.path(forResource: bundleName, ofType: nil)
class Localizer: NSObject {
class func swizzleMainBundle() {
MethodSwizzleGivenClassName(cls: Bundl... |
I am a Javascript/JQuery beginner working on my first ever project. Everything in this program is working as it should and I am happy with its performance. I have pieced it together from a variety of sources and lots of trial and error.
Because this is so new to me I wanted some experienced opinions on the way I have u... |
The challenge:
You managed to send your friend to queue for tickets in your stead, but there is a catch: he will get there only if you tell him how much that is going to take. And everybody can only take one ticket at a time, then they go back in the last position of the queue if they need more (or go home if they are... |
I have written a Lottery contract that picks winner based on the amount they contributed to the pool. I am looking if the code of weightedWinner function can be optimized. And if there is a better way to write the random function.
pragma solidity ^0.5.12;
//import "./SafeMath.sol";
contract WeightedLottery {
//us... |
I'm working on a project to downsample some fastqs (files that contain sequences).
Each line of the fastq bioinformatics format comprises 4 lines chunks
(id, dna sequence, "+", quality score).
Downsampling
a fastq is going to select n number of chunks or select x% of chunks.
But I don't handle the downsampling: I just... |
I developed a function that, from a given sequence of digits, extracts the date and reformat it.
This is the code:
from datetime import datetime as dt
def format_dates(field):
n = len(field)
match = False
i = 0
while match is False:
try:
# Take the last four digits
ye... |
I need to concatenate the LastName and Initials and all of that authors affiliations. Is there a better way or faster way to do this? I'm very new to working XML in JavaScript.
This is a portion of an XML string that I get back from an API that I parse in JavaScript:
<AuthorList CompleteYN="Y">
<Aut... |
If you need to kill the same process that you're in (for testing purposes or whatever) this code will do it.
A definitive, quick, unmerciful dead of the current Java program/app.
Not a System.exit(0) or a graceful dead.
A headshot to the running JVM
public class KillMe {
private static final String CMD_WINDOWS = "... |
This is my first C# project. I still am a noob to programming, and while I'm happy I carried out this project, I know that my code needs A LOT of improving and that's why I posted it here.
This code represents a Login system for a bigger application in console, a password manager. This is why the dashboard() function i... |
A few weeks ago I decided to have a look at the Rust programming language. After a few standard exercises I chose to try to implement the SHA256 hashing algorithm, because why not.
The algorithm's state is stored in a struct, similar to Python's hashlib. This is the lib.rs file:
use std::convert::TryInto;
pub struct... |
I'm trying to find the best solutions for operations on the following database:
Employee (EmployeeId, Surname, Salary, DepartmentId)
Department (DepartmentId, DeptName, City, Director)
Project (ProjectId, ProjectName, Budget, Director)
Works (EmpoyeeId, ProjectId)
My queries:
1 SQL query to find the surname of... |
I am building a simple Java command-line application. And I want to know the best practice and make my code clean. Can anybody suggest to me how many different classes I can make and what more method I need to write to make my code clean? How can I write unit testing for the methods? I am new to writing unit tests.
The... |
This bubble sort code is very slow compared to the original.
import time
import random
def bubble_sort(a):
#setting my variables
yes=0
d=0
#making a switch
while yes==0:
if d>=last_thing-1:
d=0
if a[0+d]>a[1+d]:
#switching the order
a[0+d],a[1+d]=... |
I have an NLTK parsing function that I am using to parse a ~2GB text file of a TREC dataset. The goal for this dataset is tokenize the entire collection, perform some calculations (such as calculating TF-IDF weights, etc), and then to run some queries against our collection to use cosine similarity and return the best ... |
I write decorators a lot in my work. Sometimes you need to write "decorator that takes arguments", it usually turns out to be something like this:
def decorator(**kwargs):
def _decorator(func):
@wraps(func)
def decorated(*func_args, **func_kwargs):
# do something with kwargs here
... |
#include "fmt/format.h"
#include <cstdint>
#include <cstdio>
#include <event2/event-config.h>
#include <event2/util.h>
#include <evhttp.h>
#include <memory>
#include <type_traits>
auto
main() -> int
{
constexpr char host[] = "127.0.0.1";
std::uint16_t port = 5555;
using event_base_new_type
= std::p... |
How could I further optimize my implementation of Conway's Game of Life? And how would you critique my current strategies? I'm taking a C++ optimization class, the deadline has passed and my assignment has already been submitted. We were supposed to compile with these options: g++ me.cpp -std=c++11 -O3 -march=native -o... |
I have implemented a hash table. It works well. But if you think something needs to be improved, say it. This code was tested in Python 3.7.4.
class Hashtable:
def __init__(self,size):
self.size = size
self.mainList = [[] for i in range(0,1)for j in range(self.size)]
def index(self,key):
... |
I just wrote this script to check if the name (that has 2 characters: 1 alphabet and 1 number) in Github is available or not so I can accompany this name.
Here is my script:
#!/bin/bash
for i in {a..z}
do
echo 'running ...'
for j in {0..9}
do
out=$(curl -s -o /dev/null -w "%{http_code}" "https://github.com/$... |
Use case:
I am writing a proactive session updater; The use case is for parallel API calls or sequential API calls intercept the API call and check whether token is valid.
If token is valid continue with call
If token is invalid first update the token then continue with API call.
This is a cakewalk for sequential cal... |
I made this script to calculate the amount of silence in seconds in an audio file. Is this a good method to do this, and if yes, can it be improved? It takes about 4 seconds for 20 audio files of 100-200 seconds of audio each, which seems pretty long to me.
The audio file is split in windows of win_size seconds. Every ... |
I wrote this code to track small moving objects falling down a chute. The code works buts runs too slowly: using 60 FPS 1920 by 1080 footage the code only runs at about 10 FPS. The problem there is somewhat self-explanatory as I need the program to be able to process footage accurately at real-time speeds and need a ve... |
So, purely out of desire to learn, I decided to take on a project of making my own very basic programming language from scratch. After which, I made a lexer.
I've tested the lexer (but only a bit) and it seems to work. But, I tend to doubt myself a lot (which might actually be a good thing). So I I'd like people to re... |
My approach was to visit all inversion count pair and count how many subarrays these pair contribute. Visiting every pair requires \$\mathcal{O}(n^2)\$ time, but I want an optimized version of this, something like \$\mathcal{O}(n \log n)\$.
Can I do something with the Fenwick tree?
Inversion in an array
Fenwick tree
e.... |
I have implemented a Singly linked list. It works well. But if you think something needs to be improved, say it. This code was tested in Python 3.7.4.
class Node(object):
def __init__(self, data):
self.data = data
self.nextNode = None
class LinkedList(object):
def __init__(self):
self... |
I have written the following method which works as expected. But is there a way to write this more elegantly in Java 8? Appreciate any feedback. Thanks.
private String get(Details details, Value value){
Type type = Type.getEvent(details.getType());
if(type != null){
if("SAMPLE".equals(type.typeDesc())... |
I rewrote echo from the manpage to learn Rust, and got the following:
// echo in rust - display a line of text
use std::env;
static HELP: &'static str = "\
echo the STRING(s) to standard output.\n\
-n do not output the trailing newline\n\
-e enable intepretation of backslash escapes\n\
-E disable intepreta... |
I'm working on generating large volumes of test data for some performance testing. Part of this is going to involve generating a lot of values that represent an "MBI", which is a certain kind of alpha-numeric identifier.
This identifier has the following rules:
Is alpha-numeric (uppercase only letters)
Excludes lett... |
Fetching database records and displaying as JSON. Asking for revision to ensure if everything's ok, i.e. connections are properly handled and closed in case of error.
public class Department
{
public Department(int id, String name)
{
this.Id = id;
this.Name = name;
}
public int Id { get... |
I have the following situation: I have two std::map<int,float> and I want to go through the first map one by one and find the element in the second map with the key closest to the key in the first map. Now, this plain situation is obviously addressed in other question like e.g. this one, but here is where my situation ... |
I was wondering wether my implementation of the PreferenceService below is thread safe or could cause memory leaks.
Android Studio gives me the warning "Do not place Android context classes in static fields". But since this warning is known to show in some cases where it does not really apply I am not sure if this is ... |
I have written below code using GMAIL API reference which creates a basic message, sends it and also lists all the messages from user's mailbox matching a keyword.It works fine. Looking for experts comments to improve it .
Here is the code-
# coding: utf-8
# In[26]:
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __... |
I wrote code to plot a rating distribution, which looks like this:
The most important function is the stats function:
function stats($songID){
$st=$this->conn->prepare("SELECT
(SELECT COUNT(*) FROM list WHERE SongID=:songID),
(SELECT COUNT(*) FROM list WHERE SongID=:songID AND Rating='10'),
... |
I am working on a "comprehensive" library for use in my internal applications and I have created a working method (as far as all of my testing has shown thus far) to ensure that a file/directory path is - or, at least, could be - legitimate and should be accessible to any user of the same application. NOTE: These are a... |
I am interested in hearing your opinion on the approach I have taken to have inherited classes initialize their base class.
Here's a Machines collection class from that maintains a list of Machine objects. Each Machine needs to be able to inform its parent, using a delegate, of something they do but they do not have a ... |
I have this code below that copies data into a master workbook, in sheets "Inputs1", by matching the column headers from the master workbook with the source workbook. If a column header matches, it will copy and paste that column to the related column in the master workbook.
The macro works great for smaller files, but... |
We had a little bit of fun in the 2nd Monitor this morning, one user greeted another with a hex string. It turned out that the user being greeted deals with Hex Dumps enough that they were able to read the string, but I wasn't so I created this converter.
What could I have done to reduce the dependency on cstring?
How ... |
In the past three days, I've been developing a simple raycasting algorithm. I've made the renderer work as I'd like to. However, it is extremely slow (5 frames per second) because of two things (as far as I know).
Finding the values of a pixel independently many times, and often it lands on the same pixel.
The large a... |
Given a string, return the sum of all the numbers in the string, 0 if none are present.
Below is my solution for the problem above. I feel like this can be turned into one line. I would really only like suggestions on the actual algorithm, but anything else is appreciated.
def sum_numbers(string: str) -> int:
"""... |
Given a string, assuming the string is numbers only, rearrange the string to that it is the greatest possible number.
Below is my solution to the problem above. I'd like feedback mainly on the algorithm, as I wrote this up very quickly. I used comprehension syntax to find the largest num, which I'm trying to use more... |
I am building a generic Graph. I want to know whether the current design is fine. Are there any memory leaks ? Any suggestions are deeply appreciated.
GraphCode
#include <iostream>
#include <memory>
#include <vector>
#include <atomic>
#include <map>
namespace AtomicOps
{
int GetID()
{
static std::atomic<int> id(0)... |
I have implemented a Ternary search tree. It works well. But if you think something needs to be improved, say it. This code was tested in Python 3.7.4.
class Node(object):
def __init__(self, character):
self.character = character
self.leftNode = None
self.middleNode = None
self.righ... |
I've written a module for repeating blocks of code, generally to cover issues related to eventual consistency and testing screen elements which may take some time to fully load. It looks like this:
class Repeater
def initialize(&block)
@repeat_block = block
end
def repeat(times: 25, delay: 0.2)
result = ... |
a = [5, 2, 4, 6, 1, 3]
def insert(arr):
if len(arr) == 1:
return arr
# outer loop
for i in range(1, len(arr)):
# inner loop
for j in range(i, 0, -1):
if arr[j] < arr[j-1]:
arr[j], arr[j-1] = arr[j-1], arr[j]
return arr
print(insert(a))
I am getting... |
I just started Developing Web App (Vue.js) for my company for around 1-2 months. Therefore, my knowledge and experience in HTML, CSS and Javascript is kinda shallow.
I've created a custom resizable split DIVs and it working just fine as what I wanted. However, I would like to know if my code is a good code or a bad co... |
This app will be a FTP desktop application meant to transfer files between a server and a client, pretty much like Filezilla, there is no server code to show as I will not implement Network features until I have reached a comfortable design architecture.
It is a qt Gui program, and I wish to construct it in a way that ... |
As of now the below code working As expected. But in future if the newFilterArr have new record again I want to reedit this functionality. So how to overcome this?
function Optimiz() {
let courseFilter = this.newFilterArr.find(k => k.key === 'courseId'),
rateTypeFilter = this.newFilterArr.find(k => k.key ==... |
I designed a (q)spi controller which can be configured over generics in QSYS(Quartus) and acts as an avalon slave.
The documentation started in german, so please bear with the partial translation.
I want to know if I can improve my signal handling or naming of my variables (or lets just say: what can be done better and... |
I work with electronics test equipment. I like to be able to automate tests using their remote control interfaces. I have built a pattern, a few base classes, that I can apply to all devices that follow the SCPI protocol. I would like to avoid half-assing the implementation like every time before. I wan't to bite the b... |
I'm writing a program to calculate the longest collatz sequence for positive integers below some N. I have optimized it as far as I can - is there anything more I could do to optimize it? Any constructive criticism is welcome :)
A few interesting notes: It is easy to prove (by contradiction or otherwise) that the numb... |
We have an upcoming project at work which is going to require working with express.js. I have no prior experience with node.js, so I thought I'd try and do something aside from some courses. Are there any anti-patterns and what can be improved?
Objective
I have a text file that is retrieved from an external source and ... |
I tried to implement KMP algorithm on my own and found it kind of hard to follow.
Can you please comment how would you make this code easier to read / understand.
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace StringQuestions
{
[TestClass]
public class KMPAlgori... |
I wrote this code for a simple app that gives us random images. The code works, but I feel like I'm doing something wrong. And one thing I would love to know is instead of grabbing from a folder called "resources", we would actually grab from a custom folder inside my exe. So there's no need to add any folder to a diff... |
I wrote a function that partitions an image into multiple patches. Here is the function, are there any suggestions to make it better or more production ready in terms of the best software practice?
def cal_patches(img,num_colums):
patch_list = []
num_rows = num_colums
x,y,w,h = 0,0, int(img.shape[1]/num_colum... |
So in learning c++ I have to make a little program that makes a game list that can add games to the list, remove games, and display the list, and it has to use vectors and iterators, so I made the program and need feedback on how to improve it and make it cleaner/better
// Favourite Game list
// Program using vectors a... |
I am working on an e-commerce website. I have a CarMake dropdown which contains car make names and their corresponding Id, for example: { 1:Alfa romeo }, { 2:Audi }, { 3:BMW }, etc
I want to keep this lookup in cache, so I won't have to make a trip to DB every time I want to get the corresponding Name or Id...
So in my... |
I've been learning C# during my free time in the past months; before that, I was mostly writing Java, so the transition hasn't been too hard, but I've never had my code reviewed or read by someone else.
Is there anything that could be improved, or maybe simplified?
Am I doing anything that would be considered bad pra... |
I did this coding exercise for a potential employer who failed it on the basis of unspecified style and structure issues and would appreciate any thoughts on what flaws this contains, in particular in relation to style, structure or any other important software design principles.
Program.cs
namespace ToyRobotSimulator
... |
I've decided to write some Linux commands in Python. Below is a list, along with some constraints (if you're unfamiliar with Linux, the top of the program along has a description about each command and what it does):
ls: No constraints, just lists all files/directories in current working directory. No flags.
cd: Can o... |
There is a small programming exercise to merge adjacent identical elements in a collection.
Here are two solutions (passing the tests from the exercise).
I am asking for review of the first version using standard algorithms.
The second is just for reference of the expected behavior.
template <typename ForwardIterator, ... |
Here is my problem statement:
There is a matrix of octagons, for example, 4 octagons in a row and 3 such rows. So 4 columns and 3 rows of octagons. But they are not arranged in a perfect rectangle form.
Case1:
The first Octagon, O(0,0) has coordinates(0,0), while the one at its right and the one at bottom are at a b... |
I learn about OS development and follow the tutorial Bare Bones on OSDev. And I did some extra tasks from the Moving Forward section.
I would like to get any suggestion about code improvement, especially about the Makefile and the project layout on GitHub.
kernel.c:
#include "string.h"
#include "vga.h"
#include "termin... |
I wanted a neat iterator that will always give me neat sequence of step spaced numbers. This is what I came up with, but I am a bit skeptical that I covered all cases.
/**
* Creates numeric range iterator. The iterator will iterate between start and end.
* Start may be larger than end. The output will contain both st... |
I took some boilerplate code that I have been using for determining an active windows user's info to either send emails with their details, or to pass to a error logging class, and encapsulated it in its own class.
What I would like to know about my implementation of this is: Are there more efficient ways of doing thi... |
I have previously worked on this program in this question, and have gotten some very good answers and help! Now, I have done some more work on the program, and would love if you could give me honest feedback on what I need to change.
Main
package owl;
import java.io.BufferedReader;
import java.io.IOException;
import j... |
I used the following to split sequence into batches:
source
.Select((item, index) => new {Item = item, Index = index})
.ToLookup(x => x.Index / batchSize, x => x.Item);
but it requires full materialization of the sequence - memory complexity could be high.
Are there anything ready to be used? I think there is ... |
This function should return a string that is comprised from all the letters in the Alphabet except the letters in a pre-defined list in alphabetical order.
Assuming all letters in the pre-defined list are all lowercase;
I came up with two ways to do this and I would like to know which way is more efficient or more 'Pyt... |
This program is used to get names and numbers of N person, print out the numbers of a person. Please help me improve this code.
Additional Question:
To avoid a very long name that exceeds char's size, I limit it to 255. Is there a better way?
To avoid buffer, I included a space before % sign when using scanf and not us... |
I try to dealing with sessions.. including arrays before moving to "database".
Sessions class.file
<?php
session_start();
class Sessions {
public static function ready($name){
return isset($_SESSION[$name]) ? true : false;
}
public static function get($name){
if(isset($_SESSION[$name])){
return $... |
Funny thing, the following test works:
[TestMethod]
public void Iterate_Once()
{
var x = new[] { 1, 2, 3, 4, 5, 6 }.ToIterable();
CollectionAssert.AreEqual(new[] { 1, 2 }, x.Take(2).ToArray());
CollectionAssert.AreEqual(new[] { 3, 4, 5 }, x.Take(3).ToArray());
}
Where:
static cl... |
This assumes there is no need to aggregate results from the listeners of a broadcast signal.
Technically I guess the slots are whatever your std::function holds, so they aren't special. So I guess this is more of a Signals/Connections design.
The "connection" or Signal<T...>::Listener is the owner of the callback. It's... |
This is a part of my calculator program. I have to check if the input entered by the user is a valid mathematical expression. The first check is performed by another program, where the program checks if the numbers and symbols are valid and it converts the string into tokens for further verification. The implementation... |
I wrote the following password generator, to generate a password in which each character group appears at least at once.
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class PWGen {
public static final ArrayList<ArrayList<Character>> groups =... |
I have a working code that groups items by their type values. The types can be one or multiple, however they are always returned as an array.
To illustrate: if an item has types with values type1 and type2, it should be included in both type1 and type2 properties of the resulting grouped object.
Although the code work... |
I would like to receive some advice on how to improve a small concatenative stack-based interpreter, executing a joy-like programming language. It is really minimal, and is in fact a subset of a larger version that should, a priori, be used as a compilation target.
The version I would like to review here, however, is f... |
I have a table called sales and it has below columns:
'id'
'product_type'
'soldDate'
'text'
'product_type' examples are: Tshirt-XL, Tshirt-L, Tshirt-M, Trousers-XL, Trousers-L, Trousers-M etc.
I have an array called products which is;
$products = array('Tshirt','Trausers');
My output is after executing below code:
Tsh... |
I am trying to solve this problem
You are given a list of non-negative integers, a1, a2, ..., an, and a
target, S. Now you have 2 symbols + and -. For each integer, you
should choose one from + and - as its new symbol.
Find out how many ways to assign symbols to make sum of integers equal
to target S.
My workin... |
I implemented a Column-based FLAT parser and generator, where the information is loaded from a base class, which contains the attributes that tell the column size and type.
For each line of the flat file, a new instance of this class is generated which in turn is loaded with the file line data.
My question is, what can... |
This code review request follows my previous request Computational verification of Collatz conjecture.
Unlike the previous program (which was designed for the CPU), this code should run on modern GPUs.
For this purpose, I chose OpenCL as a programming language.
Prerequisites
Since the verification program needs to deal... |
EDIT
The random number generator in this code is a blackbox for a similar algorithm that isn't publishable for privacy concern. The algorithm works in similar way, in that it takes in a seed value and generates number.
Simplifying the question
The corrupted references are from a text file, there are thousands of those... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.