instruction stringlengths 71 95.1k |
|---|
I used Python very occasionally, today I solved n queens in Python just for fun. I am sure there are better way of doing certain things in Python and can't wait for improvement suggestions!
#!/usr/bin/python3
def print_board(board):
for row in board:
for field in row:
print('Q ', end='') if fi... |
I decided to sidetrack and create a XKCD viewer. For certain functionality, I needed to be able to find the ID of the last comic published. This was my attempt. I'm using Enlive here to parse the page itself.
I struggled with trying to find a CSS selector to get the text node, then finally gave up and decided to do som... |
I am self-teaching Python. I wrote a simple and extendable version of Tic-Tac-Toe. As far as I know, I did some immature handling with too many function parameters and multiple creation of list.
Please let me know your thoughts on this implementation and how to make it better?
def create_board(board_size,to_index=Fals... |
This program will validate whether a mathematical expression entered by the user is a valid expression based off whether the expression itself has been entered with the correct scope openers and scope closers. The program will then send the results to a text file. The program will not compute the mathematical expressio... |
This file enhances PostScript with a few new syntactic niceties for defining functions with named arguments and even type-checking.
block
The first part of the enhancement consists of a new control structure called a "block". A block is a list of pairs which will be collected as key/value pairs into a dictionary and th... |
I've just finished implementing Conway's Game of Life in python-3.6:
import curses
import numpy as np
import time
from collections import defaultdict
from enum import Enum
from typing import List
class State(Enum):
''' enum class to represent possible cell states '''
dead = 0
alive = 1
class Board:
... |
This script executes a sequence of actions over time and is based on the methods exposed by the UrhoSharp framework. I am new to Unity, but well acquainted with C# so I know what I'm doing for the most part. I'm primarily concerned with performance. Is this how such problems are usually approached in Unity or can we do... |
LeetCode "Jewels and Stones"
You're given strings J representing the types of stones that are
jewels, and S representing the stones you have. Each character in
S is a type of stone you have. You want to know how many of the stones you have are also jewels.
The letters in J are guaranteed distinct, and all charac... |
As you can see here:
20% CPU in a 3 minutes and 20 seconds excessive 40 executions async/await at a time for 9700 times caused quite a bit of CPU usage.
Code:
public MemoryStream getMessageBody()
{
#region Get MessageBody
IEnumerable<BytesWraper> MessageBody = GetMessageBodySource();
if (MessageBody == nul... |
This is a very simple version of Conway's game of life. It treats the edge of the grid as dead cells and uses a very basic algorithm. Despite this it works fine.
As people might not have the SFML library installed here's a picture of what it looks like when running:
It can be paused with p and updated one step at a ti... |
In a 2-dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amounts can be different for different buildings). Height 0 is considered to be a building as well.
In the end, the "skyline" when... |
On a well known programming challenges website(CW) there is a Kyu2 eggs height problem that can be solved utilizing a variation of Pascals Triangles properties.
The problem asks to solve f(n, m) and the solution is the sum of Pascal's Triangle row m up to cell/column n, so the sum of
f(i) = (m + 1 - i) * f(i-1) / i fo... |
Readme.md
Tetris
In my quest to building a Tetris game, where you can challenge an AI, I have created and trained an AI that plays Tetris all by himself. Github link I think the easiest way to run it, is by cloning the Git and running tkinter_tetris_ai.py from the Tetris2.0/AI/ folder. See my 1 Player Tetris Question f... |
I have a file in which I was to check the string similarity within the names in a particular column. I use fuzzywuzzy token sort ratio algorithm as it is required for my use case. here is the code, is there a way to speed it up? It is taking a lot of time for 30000 records.
import csv
import itertools
import pandas as ... |
This is my first attempt with a lisp language. I'd like your review to address the following points, already listed in order of relevance:
Is my code making good use of standard library?
Is my code using the right data structures?
Is my code well formated and organized?
Is my code computationally efficient?
Code:
(ns... |
I have made a little example of a code that stores frames of a camera in a buffer that runs in a separate thread and another thread can consume it. Is this model efficient?
//isEmpty_buffer is an atomic<bool>
//Mat is a opencv Matrix of pixels
//Max buffersize is 1000
//Camera mutex is a shared_timed_mutex
Mat Camera... |
I created a table with the ability to edit with popup.
This part of the code, which includes:
the ability to send URL to other users with the subsequent opening of the same state (the popup window is empty or with data to be edited)
I get the current URL and then I get data from the server. And if the URL includes ID... |
I'm learning websockets and wanted to make a websocket onmessage logger which writes the received data in a mongodb.
I'm starting my script with
node listner.js
listner.js:
'use strict';
let DBAbstract = require('./db-controller');
const WebSocket = require('ws');
// getting an instance of a mongodb connection
let... |
I want to procedurally generate several points on a graph that are suitably distant from each-other. These points are meant to represent castles that are part of towns in the world-map of my game. However, I still find these points very close or touching. How can I create a set of points that are all at least a certain... |
I have implemented Lagrange polynomials, i.e.
\$l_j(x) := \prod_{\begin{smallmatrix}0\le m\le k\\ m\neq j\end{smallmatrix}}\frac{x-x_m}{x_j-x_m} = \frac{(x-x_0)}{(x_j-x_0)} \cdots \frac{(x-x_{j-1})}{(x_j-x_{j-1})} \frac{(x-x_{j+1})}{(x_j-x_{j+1})} \cdots \frac{(x-x_k)}{(x_j-x_k)}\$
where the product is supposed to be e... |
I implement a complete tree as a layer for adding a hash, heap, and other things on top of it.
The Complete_tree_node templates can be reused regardless of the number of layers added to the tree.
This tree layer helps to hide the memory organization of the nodes from the algorithms. Currently, the Complete_tree uses a... |
I have a rest service on Azure AD that calls other rest services. They use AzureAd authentication and AuthContext with a custom TokenCache that stores each users tokens in an InMemory EF Core database. Sometimes I'd get exceptions in AfterAccessNotification when I'd call SaveChanges().
var cache = context.TokenCacheEnt... |
As a complete "newbie" to JavaScript when I started a project, I did actually manage to get what I needed to to work, but it is VERY clunky and inelegant.
I am hoping someone may be able to help me with cleaning some of the iterables I have that build a DXF (drawing exchange file) file. The DXF is importable into Autoc... |
Combinations is how many ways to take k elements from n element. Combination is different from permutation in that order does not matter in combination. Combination is used a lot in poker calculations. Those are combinations used a lot in poker that I know are correct.
In Fast there are a number of terms that cancel ... |
My code returns the correct answer the first duplicate is 3 (represented as int f) . I am struggling finding a more efficient way to find the first duplicate?
My constraints are \$ 1 ≤ a.length ≤ 10^5, 1 ≤ a[i] ≤ a.length \$ .
class Program
{
static void Main(string[] args)
{
int[] a = {2, 3, 3, 1, 5, 2};
... |
This is one of my first JavaScript projects. It works (at least in Firefox and Chrome), but I would like to know if this code follows common best practices.
This script is supposed to look for <audio> tags with class name audioPlayer and build up a separate interface around each one. It allows for multiple audio files... |
The logic is like this:
All brands have 2 products (Rose and Tulip)
Each brand names their product name differently (such as Brand 1 names their rose as No. 1 Rose and Brand 2 names their rose as No. 2 Rose )
All brands don't have products from all countries (Such as Brand 1 has Roses from USA and US whereas Brand 2 h... |
This is a simulation code that runs a multi-agent system, developed to model the dynamics of how prices are fluctuating as the agents make their actions on them. Each agent can make a decision of 'get' or 'remove' the selected option depending on its value and price. There are many enhancements that I couldn't implemen... |
I have written the code that retrieves the data from XML file using xml.etree. Is there any best way to store the data into database by parsing an XML file.
My code:
from xml.etree import ElementTree
import mysql.connector
dom = ElementTree.parse('profile.xml')
ticker = dom.findall('TICKER')
name = dom.findall('NAME... |
I have to create a Hotel database according to these requirements:
information about guests should be found, information about rooms divided into categories, reservations (ordered by a type of a room and assigned for a specific type of a room).
the following functionality should be provided: make a reservation by assi... |
I writing a function in Python to substitute word tokens in a sentence with IDs.
The sentence is a list of tokens (list_of_tokens).
The IDs are provided in a dictionary mapping tokens with an IDs (tokens2IDs_dict).
However, the functions I've written is not very efficient because of the for-loop. I am wondering if the... |
Restaurant Menu
It works how I want it to, but the way I've written the jQuery looks like it could be simplified.
How can I rewrite the jQuery so it does exactly the same thing but in much less code?
I need only the first square of JavaScript rest is only an understanding of the code
$(document).ready(function() {
... |
I insert a value into a SQLite database and return the id of the last inserted value as a result of the method.
I asked a question on Stackoverflow and I found this solution to my problem. Now I would like to get feedback if there is a simpler, smarter and/or safer way to do that:
int MyRepository::Insert(std::shared_p... |
I wrote a stored procedure that will do a merge of two tables:
CREATE PROCEDURE [dbo].[merge_tables]
-- Add the parameters for the stored procedure here
@SourceTable varchar(50),
@DestinationTable varchar(50),
@PrimaryKey varchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering wi... |
The following snippet is an object that handles each of my app's data management views. When a view is created in App.partialView(), I have hard-coded each element that is used to edit that view's data. Some of those elements are select lists that contain data from another view within the same App.dataManager(), never ... |
This is a very basic problem of implementing a queue operation using two stacks.
Until now there are no issues with the logic but the testing tool report it takes more time than usual.
Test case includes total 100K operations of enqueue, dequeue and show_front. Each item is of 9 digits.
The test tool expects it to be c... |
Please review my code. I am trying to implement a thread-safe LRU cache using std::list and std::unordered_map. This is a header-only template class which you can use to keep an object cache.
The constructor takes a size as an input parameter and creates a cache of a specified size. Items will be removed based on the l... |
Here I am trying to post a company view-model and update and insert according. But I feel I am writing it in wrong way or maybe there's a better approach.
Here's my code
[Route("Master/Company/Post"), HttpPost, ValidateAntiForgeryToken]
public async Task<ActionResult> CompanyPostAsync(CompanyViewModel model)
... |
This is a follow up question to this one.
I have been working on this game for some time, and now I would like it to be reviewed. Most importantly, I want to know about my code readability, commenting, naming, efficiency, code practicality, class and method splitting. Also I'm afraid that the code is needlessly complic... |
I am in the process of removing the last few pieces of mutable state from an F#-based distributed system. Some of the remaining mutable state is a ConcurrentDictionary used in some Akka.net actors to store messages, look them later, update their statuses, etc. We had some problems with locking on the ConcurrentDictio... |
I've got a short algorithm used in my code to multiply two matrices and put them into a destination Matrix. I decided to use the temporary array t_elements, which allows the user to make one of the input matrices the output matrix as well.
Usually I like to save optimization for later, but this code is going to be cal... |
Way more blood, sweat, and tears have went into this then I would care to admit, but this has been a function I have been using in some shape or form for quite a while and it has taught me alot.
It does exactly what I want it to do ATM but happy to hear any suggestions on what could make it run more efficent. I am loo... |
I am new to bootstrap and trying to design login page. Please check my below link and let me know if i did it in wrong way.
I have on doubt I think i am doing in wrong way because when i inspect my html page(right click inspect element) on form then i notice form width is less than input field. <form class="form-verti... |
Unique Morse Code Words
International Morse Code defines a standard encoding where each letter is mapped to a series of dots and dashes, as follows: "a" maps to ".-", "b" maps to "-...", "c" maps to "-.-.", and so on.
For convenience, the full table for the 26 letters of the English alphabet is given below:
[".-","-..... |
I am practicing interview questions and have written the following
code for the given task.
Task : Given a non-negative number represented as an array of digits, add 1 to the number (increment the number represented by the digits). The digits are stored such that the most significant digit is at the head.
Code:
class ... |
I have been following the FreeCodeCamp, and I am done with the basic algorithm challenges. The last one (CaesarsCipher) troubled me a bit, though I had done a similar one without much problem in C, for CS50 course.
Finally I made it work, but at the moment I am self-critical about "How?" I made it work and the quality ... |
Kindly help me check this code, I want to be able to make it load thousands/millions of different pictures as HTML background without crashing or slowing down the browser.
The images can be created dynamically, or linked to its folder, I was able to do that for up to 1000 images/colors per canvas, and add up many more ... |
TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL.
Design the encode and decode methods for the TinyURL service. There is no restriction on how your encode/decode algorithm should work. You just need to ensure that a URL can be enc... |
A year or so ago, I wrote a checkers game for the Universal Windows Platform. Now, I wrote a web-based version of it hosted at http://checkerstreasury.azurewebsites.net. This is the first of a series questions about my best practices.
Related to Checkers Board Editor, but web-based.
The requirements of this system are ... |
Just want to know if I used CSS Grid properly along with flex. I always have that feeling that what I'm programming can look better and be shorter, etc. Thoughts?
/* Main */
@import url('https://fonts.googleapis.com/css?family=Quicksand');
body {
background-color: #ecf0f1;
margin: 0px;
padding: 0px;
}
.grid {
... |
I need to iterate over a large (in the thousands) list of files in a network folder and "concatenate" any image sequences into just one entry with the range of images (first image, last image in sequence). I am calling this "sequence pruning" and I created the following code which does work, but it seems incredibly un-... |
I'm just starting to look into Haskell. I've written a naive Fibonacci implementation, and I've also written a more advanced one that uses tail-call recursion for efficiency.
module Fibonacci where
import System.Environment
fibonacci :: Integer -> Integer
fibonacci 0 = 0
fibonacci 1 = 1
fibonacci n
| n < 0 = erro... |
I made this and left it up on a gist a while back broken. I don't like broken code, so today I spent a while getting tests working, using more sensible names, and making tests pass. Its goal is to take inputs in the form of:
[
('root[subnode][name][]','that guy'),
('root[subnode][attribute][]','somevalue'),
... |
I've got some methods that follow a similar pattern, and wanted to abstract some of the logic away into an extension method. Specifically, I am processing lists of objects with the TPL, and throttling that processing with a SemaphoreSlim.
public static Task ValidateProxiesAsync(IList<Proxy> proxies, IList<ProxyJudge> j... |
I have been writing a python text adventure and the map module i wrote is very clunky. It is a list with compass dirs as the navigation. The problem with this is, i refer to each room by index number, and this is SUPER confusing. If anyone has any helpful advice it would be greatly appreciated.
map module (the sub-lis... |
I wrote this simple SQLiteOpenHelper in order to use in one database various tables containing String records (each record having a String identifier, and associated String fields.
When you create a table, you have to call the createTable method with a table name and its number of fields. Table fields are then created ... |
My code can play the tic-tac-toe game with two human players. How can I can make it better ? I will be making a new version that plays tic-tac-toe against a computer later.
/* Tic Tac Toe - Player 1 vs Player 2*/
#include <iostream>
using namespace std;
#define SIZE 9
//----------------------------------------------... |
I'm working on a markdown-to-html parser for my C++ proposals. Example usage is turning markdown like this into an html page like this. The part that caused me the most frustration was having (a) tables that (b) themselves can internally use markdown. I ended up with a hacky solution that happens to work right now (bas... |
I am still relatively new to Python but I have been actively doing sample examples to try and get used to problem solving aspect of programming.
With that said, I stumbled upon a question that asks you to write a code to convert DNA strand to its complementary form.
What I have written works, but I don't believe that m... |
Task : Find out the maximum sub-array of non negative numbers from an array.
The sub-array should be continuous. That is, a sub-array created by choosing the second and fourth element and skipping the third element is invalid.
Maximum sub-array is defined in terms of the sum of the elements in the sub-array. Sub-a... |
I have the following code to get data using async/await
import fetch from 'node-fetch';
let bid = 0;
let ask = 0;
let lastBuy = 0;
let buyOrders = [];
let sellOrders = [];
const currency = process.argv[3].toUpperCase();
const getOrderBook = async () => {
const orderBook = await fetch(`https://bittrex.com/api/v1.1/p... |
The following program implements a calculator that takes string inputs in the form of two values separated by an operator. It splits the inputs in to their parts, and then applies the operation, and outputs the result.
As per my understanding I implemented it using Object Oriented patterns.
I am a beginner to Java Pro... |
The General Idea
I wish to simulate something which works like Java's ThreadExecutor, but as a first step, I would like to run a fixed number of identical tasks in parallel.
The next step should be queuing different tasks.
The method in question
public static async Task RunTasks(Func<Task<bool>> action, int tasks, int ... |
I'm building a compiler for fun, and this is my first pass at the lexer for it. It should handle all tokens for C99, with the exception of the preprocessor tokens. It's very minimal, only grabbing the token and lexeme. Specific areas where I'd like feedback:
I rarely get to use anything beyond C++98. Are there any mor... |
I am looking for a way to reduce the minified (by the Closure Compiler with ADVANCED_OPTIMIZATIONS) size of my code. To do this, I am looking for a way to apply a function to each member of a destruction assignment. Browser compatibility is not a concern just so long as Closure understands it. The following is a conden... |
Using the columns 4 and 2 will create a report like the output file showed below. My code works fine but I believe it can be done shorter.
I have a doubt in the part of the split:
CNTLM = split ("20,30,40,60", LMT
It works but will be better to have exactly the values "10,20,30,40" as values in column 4:
4052538693,2... |
I built a webscraper to take all the historical data from CoinMarketCap.com. A site which records historical data for cryptocurrencies which unfortunately does not have a feature to download all of their data in one convenient file.
It works but it's somewhat slow and probably could be designed better. I'm self taught ... |
There is a way in Scala to selectively change a field while making a copy of the immutable object:
case class Phone(areaCode: String, number: String) // declare type
val original = Phone("832","123-4567") // instantiate
val changed = original.copy(areaCode = "425") // get an updated copy
While in C# it looks like a r... |
I have multiple places where I need to make ajax requests to fetch the items corresponding to some ids. However, I only want to make a single request by accumulating these ids and debouncing the actual method that makes the ajax request...So far I've come up with this code, but it just feels ugly/non-reusable.
Is there... |
Does anyone have any tips on how I could improve my code
function pascal(row){
for(var k = 0; k<=row; k++){
var pascalRow = [1];
for(var i = 1; i<=k; i++){
pascalRow.push(pascalRow[i-1]*(k+1-i)/i)
}
console.log(pascalRow)
}
}
pascal(/*Insert # of rows here */)
|
I get as an input a char array in this format: "key = value\0key = value...\0" (last pair is ended with 2 NUL terminators - one is the pair end + one is the whole string end)
and I want to split it into pairs of {key, value} in order to print them.
This is my approach; is there a better way (strtok-like) to do so?
cha... |
I implemented a multithreaded TCP client in java for use in an android application. The purpose is to implement the TCPClient interface to allow another thread to post strings to the server and read responses without needing to deal with any of the networking. It doesn't use any android specific code except for the log... |
In my Android app, I need to disable a button in Layout if the api return status as 0. I get this status in the Adapter and based on it, I have disabled the button in ViewHolder which is inflating the corresponding Layout.
This is a part of the Adapter class.
BufferedReader br = new BufferedReader(new Input... |
The following code is a simplified version of what I want to achieve. Each object may have one of several states, and the overall collection state depends on the state of each of these objects. Currently, the code is written in the form of several if-else blocks, however, it seems ugly and non-extensible. By that, I me... |
I'm using the asset BestHTTP in unity and I'm downloading a few image from amazonaws to use as texture. It used to be one image, but now I have a few.
I was not able to shorten it. When I'm trying to do it in a foreach loop loop it is misbehaving.
Could someone help me to optimize this working code?
for (int i = 0; i... |
Input
array([[10, 11, 12, 13, 26, 28, 11],
[ 4, 9, 19, 20, 21, 26, 12],
[ 1, 7, 10, 23, 28, 32, 16],
[ 4, 6, 7, 10, 13, 25, 3],
[ 4, 6, 15, 17, 30, 31, 16]])
test = np.array([10, 11, 12, 13, 26, 28, 11])
Trying
def check(test,array):
for i in array:
if np.array_equal(i,te... |
I am a beginner in TDD and I just coded a Calculator in Python with TDD approach. I would be more than happy to hear your opinions out. And since I am a beginner in TDD, I would love to hear some tips.
Tests :
import Calculator
import unittest
class CalculatorTests(unittest.TestCase):
def setUp(self):
s... |
I'm new to C++ and wrote this Bank Management System app. It's one of the projects that everyone does as a beginner. This app runs perfectly so far. I tried to use OOP and encapsulation in this app. It also helps the User to store and retrieve data from HDD.
I'd appreciate if someone could give me feedback in the areas... |
To find the days off for our custom accounting software there is this method used to find when is Easter in any given year.
private static DateTime Easter(int year) {
int a = year%19;
int b = year/100;
int c = (b - (b/4) - ((8*b + 13)/25) + (19*a) + 15)%30;
int d = c - (c/28)*(1 - (c/28)*(29/(c + 1))*(... |
I made this little library that makes the title of a webpage scroll so you can see the entire string. I'm not sure if this is the best way to accomplish this so if anyone has any input that'd be great.
title-scroll.js
var start = 3000;
var speed = 250;
function getParams(startAttr, speedAttr) {
var params = window... |
For a course I need to build a peptide from scratch that matches the given spectrum. So I start with the amino acids that are in the given spectrum and filter those out that do not have the right criteria. Then I trim this so called leaderboard, and expand them.
Here I add all the amino-acids (20) to the already exist... |
Please assist and review the following task.
There are many geographic data to be found using the Bing Map server. It is necessary to collect data, parse bing response and store it in one of two files, depending on the result. I need to make it parallel as it could a lot of data. I do not like how I parallel the code,... |
I m writting some API which would use configuration-like arguments.
Here is an example configuration which will be used by my API
quail.run(
quail.SolutionPacked(path='Allum1'),
quail.Installer(
name='Allum1',
icon='icon.jpeg',
binary='allum1',
console=True
),
quail.build... |
Below is a bit of code which divides an alphanumeric string to a map of numbers and strings (assume numbers are single digits and non-repeating).
Example input:
String alphaNumericStr = "1abcdef2xyz9aaa6xxx";
Output:
Map<Integer, String> map = {1=abcdef, 2=xyz, 9=aaa, 6=xxx}
This is the code i wrote. While it... |
I have a class that tests a list of proxies for validity concurrently, which I have created in 2 different ways, one utilizing Parallel.ForEach and the other using a TPL Dataflow ActionBlock.
I am just wondering which is one is preferred, and if I am overlooking something important. As a side note, I created the Dataf... |
I am relatively new to python and I am still trying to learn the basics of the language. I stumbled upon a question which asks you to rearrange the list by modifying the original. What you are supposed to do is move all the even index values to the front (in reverse order) followed by the odd index values.
Initial:
0 ... |
This is my best effort to code an x86 32 bits to get an unsigned int (4 bytes) and convert it into a string. My strategy was successively divide the number by ten and fulfill the remainder of the div according its position in the heap pre-allocated string. I am assuming the bigger value has 10 digits at most.
File i2a.... |
I am trying to solve a problem as described below:
You are given an input of a n*m forest.
You have to answer a group of inquiries. Your task is to return the
number of trees for every inquiry.
Input: In the first line you are given 3 integers; n,m and q. This means that the size of the forest is n×m squares and the... |
Multiple AFNetworking calls In a view controller.
The code is very wield.
I think , to negotiate with the server , and combine those into one url, instead of many urls.
@interface HomeViewController ()
#pragma mark - init user info
- (void) initUserData
{
[self get_userInfo];// user login info about
[self g... |
This is the "Maximum sub-array" problem from CodeChef:
Find out the maximum sub-array of non negative numbers from an
array.
The sub-array should be continuous. That is, a sub-array
created by choosing the second and fourth element and skipping the
third element is invalid.
Maximum sub-array is defined in terms ... |
Similar to the code review I posted last week for an agent-based immutable replacement for ConcurrentDictionary, I have also created an agent-based immutable replacement for ConcurrentQueue. This uses a MailboxProcessor and an immutable queue based on Okasaki's implementation in Purely Functional Data Structures with ... |
My goal is to work out which lines a piece of text is on within a set of paragraphs.
For example, in the image below:
I want to find text starting from "Maecenas non" to the next instance of "nisi" and return that the sentence starts on Line 3 and ends on Line 6.
My attempt is below, and it does the job, but I don't t... |
In our applications we have a version file that has three variables that are then joined to create a string that can be used for the semantic version.
The file looks like:
# frozen_string_literal: true
major = 0
minor = 1
patch = 0
PORTAL_VERSION = [major, minor, patch].join('.')
And then we update it using the foll... |
I need to make the following C program: Given A (N, N) matrix (2D array). The program needs to find the min element in each column. Then it needs to multiply the row in which the element is, with the difference of its indexes (a[i] * i - j). Then transfer the new row on another matrix. Print the new matrix.
Here is my ... |
I've written out some VBA code that sets various filters onto pivottables. The problem I am experiencing is that it is extremely slow and bogs down my system heavily.
I've tried implementing various things to speed up the code, but nothing really has that much of an effect.
The reason I am doing it this way is the filt... |
How can I optimize this code which can get the length of non-repeated numbers in an array?
package com.sujay.practice;
import java.util.HashMap;
import java.util.Map;
/**
* Find the length of non-repeated numbers in an array
* @author Sujay
* 08-May-2018
*/
public class DuplicateValuesInArray {
public static... |
I tried to make a python code that would answer the Joseph problem. I really had a hard time with this and the try blocks was the only thing I could come up with. Can anyone tell me if the way I did it is valid or I have to rewrite the code because its too bad?
The problem is:
People are standing in a circle waiting t... |
The question asks to rotate an image/matrix by 90 degrees. Ideally it asks to do it in place but before that I decided to do it using extra space because this is my first time working with matrices.
question:
while using extra space, could this have been any better?
def rotate_m1(matrix, d):
"""
with extra spa... |
I've made a simple querybuilder for my job, but I'm kind of insecure about starting to use it because I'm afraid of errors happening when I start using it. I've done some tests with where, join, etc... So far I didn't find anything, but if someone could take a look and see if there's something missing, I would apprecia... |
Fellow JS devs, I have come across a fairly simple question which has puzzled me. When the user submits a form I disable all inputs and submit button changes to a loading animation (fa-spinner from fontawesome). Once the form submit is complete then I restore the previous state, and enable everything back.
My question ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.