instruction stringlengths 71 95.1k |
|---|
Refactored code here
I want to write a very simple Linked List with only 3 methods Append, Remove and Print. This is not for production and is to be treated as code that could be used in an interview or a quick and dirty prototype. I'm really curious about the approach I've taken here to ensure no duplicates appear in ... |
Rumor is that the next version of C will disallow sign magnitude and ones' complement signed integer encoding. True or not, it seems efficient to not have to code and test for those rare encodings.
Yet if code might not handle such cases as non-2's complement, it is prudent to detect and fail such compilations today.
R... |
I asked another question the other day and decided to rewrite the code with some of the suggestions given and add functionality (instead of reading from a console I'm reading directly from a file) the code works.
Looking at it, I think the nested for loop on the encode function doesn't look that good. I tried using std... |
Thanks for all the feedback, I optimized the code here.
Here I'm Writing a very simple Queue of struct Nodes with only these methods get_front(), get_back(), pop_front(), push_back(), print. I hope using namespace std; is okay, I will note it should not be used this way in production and I am only using the approach to... |
I have made a login system where the inserted_id and inserted_password are sent to the login.inc.php via the XMLHttpRequest. I'm not sure if my PHP script is secure. I need some securing advice for my script.
login.inc.php:
<?php
session_start();
$conn = mysqli_connect("localhost", "root", "", "users");
$pa... |
Any typing, or other improvements that you could make for this simple function?
def get_json_parsed_from(url: Union[str, bytes]) -> Dict[Any, Any]:
"""Gets a JSON file and returns it parsed, or returns an empty dict if any error occurred."""
try:
headers = random_headers()
headers['Accept'] = 'a... |
Can I improve its typing? Is there any other improvement or pythonic change that you would do?
F = TypeVar('F', bound=Callable[..., Any])
# This is mostly so that I practice using a class as a decorator.
class CountCalls:
"""Logs to DEBUG how many times a function gets called, saves the result in a newly created ... |
Kata: https://www.codewars.com/kata/linked-lists-remove-duplicates/train/python
Description
Write a RemoveDuplicates() function which takes a list sorted in increasing order and deletes any duplicate nodes from the list. Ideally, the list should only be traversed once. The head of the resulting list should be returne... |
I was given the task to download files for a FTP server. The download should be fairly fast. 15 parallel connections can be used.
I have used FluentFTP as the underlying library taking care of the technical details of FTP.
Here is the FTP client and tests below.
using System;
using System.Collections.Concurrent;
using ... |
I am quite new to Javascript. For a school project we wrote a website that displays the user's location on a google map alongside with some objects such as vehicles or passengers.
I rewrote my code to include async...await syntax after learning about them. But I still do not know if the code is any good, or if it coul... |
I have been developing a graphical calculator, and to allow for natural user input I have written a function which converts their input into a python readable form.
This is my first time using regex, and I believe I managed to get each of the expressions to do what I intended by them.
However, as can been seen there ar... |
In my previous post I had a number of steps given to me from the accepted answer on how I can write more production ready code. In this post I want this code to be reviewed as near production code I'd write in an interview. I'd like to know how well optimized my code is now from this improvements I've made to it. If th... |
I'm doing the MOOC Java course (CTRL+F "distribution"):
The input of the program is a set of exam scores of a course. Each score is an integer. When -1 is entered, the program stops asking for further input.
After the scores have been read, the program prints the grade distribution and acceptance percentage of the cou... |
The gist of the code is, you give it a date, it will start counting down how many days, hours, minutes and seconds left by emitting an event 'countDown' and once 0 is reached 'expired' event is emitted.
How can this code be improved?
class DateCountDown {
listeners: Map<string, Array<Function>>;
constructor(da... |
This is my practice program: a simple dialog box using which a user may specify a frequency of a sinus audio signal, and play it via pressing a button. It contains a GUI:
App.java
package net.coderodde.fun;
import javafx.application.Application;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javaf... |
I have a listview of PrivateFile objects which contain the fileId (int), fileName (String) and the fileContent (byte []). In order to share the file, I currently save the file first, open it again, and then I share it. In my opinion this is really semi-professional. Is there a way wherein I can only share the file (con... |
I am trying to find a best match for a name within a list of names.
I came up with the below code, which works, but I feel that the creation of the intermediate ratios list is not the best solution performance-wise.
Could it be somehow replaced? Would reduce be a good fit here (I have tried it, but could not get the in... |
My code get data from database using AJAX the problem is i want to filter data by month year and quarter and the code that does that is:
->where(\DB::raw('MONTH(created_at)'), Carbon::today()->month);
However can't put it in a variable for example and call it so i did this it works but looks ugly.
I have this code in ... |
This code will take as output any string (long, empty, with spaces...) and will return its reverse. Can I improve this algorithm so that it can be faster?
Right now its complexity is \$O(n)\$.
def reverse(stri):
output = ''
length = len(stri)
while length > 0:
output += stri[-1]
stri, lengt... |
I am doing a code challenge of codesignal.com which ask for following things:
Given an array of integers, sort its elements by the difference of their largest and smallest digits. In the case of a tie, that with the larger index in the array should come first.
Example
For a = [152, 23, 7, 887, 243], the output should b... |
I'm trying to get familiar with unit testing. I never implement TDD previously, but I believe it's the best way to write software.
So, here I'm trying to test my isLastTwoDates(position) method of my model class:
package se.abccompany.models;
import org.joda.time.DateTimeZone;
import org.joda.time.tz.UTCProvider;
impo... |
I made a simple data entry application in WPF MVVM and was just hoping for some input as I am pretty new to WPF . I have done the same application using winforms. Now I have recreated the same application using WPF.
I have understood how to write wpf based application, how to use command and other aspects of c# develop... |
I was trying to write a function that would get a random card from a dictionary of cards in a players deck weighted by the number of cards of each type you have.
I don't know if the solution I came up with is the fates way of doing something like this and this is something I'm going to be doing a lot per turn because o... |
I'm currently working on a linux daemon and would like some feedback. The program is a simple unix socket server that sends around gob encoded messages. I'm still getting the hang of concurrency in go and I'm not terribly confidant the socket server is passing around messages properly especially on shutdown. Hopefully,... |
The following Go program parses a gzipped XML file (available here) which contains bibliographic information on computer science publications and has the following indicative structure:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE dblp SYSTEM "dblp.dtd">
<dblp>
<article mdate="2017-05-28" key="journals/act... |
I'm new to Pandas, and slightly new to Python as well (but not development in general). I've got a chunk of code that works, but it feels like I'm missing out on the Pandas/Python way of doing something, and would love some feedback.
In short, I'm doing calculations over a fixed period of time (say 60 months) where I a... |
I read time complexity of radix sort is O(wn) or O(n log n), if all n numbers are distinct. After implementation it look to me as if I have implemented radix sort which has time complexity of O(n ^2). Please take a look at my implementation and suggest, if there is some implementation problem or my observation about ti... |
This was my first time attempting a project like this, so I figured it would improve readability, and would also just be nice If I allowed each stage to be visualized.
Also, this only generates them, I haven't done any solving code, so it can't know if a puzzle has multiple solutions. I didn't forget, I just want to pe... |
Building upon my previous question, I have come up with a method that'll search through a buffer and return a pointer to the end of the line. The primary purpose of the function to extract rows from a csv file using the logic specified in RFC4180; the third parameter isQuotedSequence can be used in cases where parsing ... |
A whiteboarding challenge: Given a 2D array (matrix) inputMatrix of integers, create a function spiralCopy that copies inputMatrix's values into a 1D array in a clockwise spiral order. Your function then should return that array.
inputMatrix = [
[1, 2, 3, 4, 5, 6],
[7, 8, 9, 10, 11, 12],
[13, 14, 15, 16, 17, 18],... |
The purpose of this program is to keep track of some stocks that we bought in a game and every week we must list the closing prices of each stock in a Google Sheet. I thought since I had a lot of different investments to keep track of I would write a quick script to do it for me. And I could have my friends in class se... |
What I'm trying to create is a generic tooltip component that I can use anywhere. I decided on a stateless component and the use of hooks and ref.
Explanation
Hook, because I wanted to have a flag for hover and ref to get element width and/or height to center it correctly.
Problem ❓
Is this solution correct and will p... |
This is an implementation to simulate the basic functionality of c++ shared_ptr.
This doesn't provide features like custom deleter and make_shared().
I would really appreciate any feedback to improve the below code, any other api's that I should be providing etc.
#ifndef SHARED_PTR_H_
#define SHARED_PTR_H_
#include <u... |
As a first project in Rust, I'm translating an existing, working piece of Python code. This code's purpose is to convert a 15-character Salesforce Id (which is guaranteed to be ASCII, exactly 15 bytes of base-62 data) to its 18-character equivalent, which includes a 3-character suffix to discriminate between values dif... |
I just made my first registration form with password confirmation, hashing with BCRYPT and PDO. As a beginner, looking around on StackExchange, I seem to miss a lot.
To keep it simple for myself, I coded PHP and HTML on the same page. Hence I'm just into PHP for 3 days now.
if (isset($_POST['register'])) {
$name... |
I developed a simple and short java game in which a random word is selected and the user needs to guess it's letters one after another.
I'm a java beginner so I'll be glad to hear your thoughts.
WordsBank:
import java.util.Random;
public class WordsBank {
private final String[] Words;
// Ctor
public Words... |
I am making plant growth program, and it works right now. But compared to other programs that interact between classes, mine looks inefficient to work. (for example, in Growth class, add "Environment" into init function and expressed as self.Environment.~) I tried to interpret other codes, but too complicated to unders... |
This is a controller, which receives the validated input from a http request, then finds the assorted model and for each translation key in the received data, it will add it to the model.
public function update(UpdateMenuItemRequest $request)
{
$validated = $request->validated();
$item = MenuItem::findOrFail($... |
I'm starting to code in the OOP way, but I have doubts with the following example.
I have a Product entity and I want to import & create instances of this entity from a CSV file.
I load the CSV file into an array in another part of the code, then I pass the array with the data to CSVImport class.
class Product
{
... |
GlueArrays is used for iterating over an array of arrays, and it looks like this:
Main.java
import java.util.Iterator;
import java.util.NoSuchElementException;
public class Main {
public static class GlueArrays<T> implements Iterable<T> {
private final T[][] arrays;
public GlueArrays(T[]... arra... |
I need to find correct index in a array by comparing ranges. Here is my first try:
int TunerDriver::TunerLookUpTable(double Freq) {
Freq /= 1e6;
if (Freq >= 60 and Freq < 140)
return 1;
else if (Freq >= 180 and Freq < 280)
return 2;
else if (Freq >= 280 and Freq < 460)
return 3;
else if (Freq >= 1... |
i=0
while i<=10:
i+=1
if i==5:
continue
print i*5
It prints the multiplication table of 5 as well as skips the 5th number in the series
|
A Mutual Fund data vendor is updating all Mutual Fund prices partially from 6 PM to early morning at 1 AM. Starting from 6 PM, I started to download prices for every 30 minutes.
1st download - 2 Fund houses updated their prices
2nd download - 8 Fund houses updated their prices
3rd download - 5 Fund houses updated thei... |
i'm running a for loop that loops over all the rows of a pandas dataframe, then it calculates the euclidean distance from one point at a time to all the other points in the dataframe, then it pass the following point, and do the same thing, and so on.
The thing is that i need to store the value counts of the distances ... |
There's a struct named Player containing name and stat:
struct Player {
name: String,
stat: Stat,
}
struct Stat {
points: u32,
fouls: u32,
}
And I have a Vec<Player>. What is interesting is that there can be multiple players with same name and different stats like the following:
let players = vec![
... |
I need to compare 2 objects to determine if they have strictly the same properties.
This is what I came up with so far:
import isEmpty from 'lodash/isEmpty';
const shallowPropertiesMatch = (firstObject, secondObject) => {
if (isEmpty(firstObject) || isEmpty(secondObject)) return false;
const firstObjectKeys = O... |
I am attempting to return all users and security groups that begin with the provided substring. The following does work but I suspect there may be a better way to write this and am interested in both improving the performance and the style of the Search function.
ActiveDirectory.cs
public static class ActiveDirectory
... |
I made a Minesweeper for school and it works already. The only problem I have is that I need to optimize one part of my code but I have no idea how. The code below is for the whole program. The second form is just a page for explaining to the user how to play. The part I need to optimize is the part where I basically r... |
I want to write a very simple std::string like compile-time const char* string.
I need to work with strings in the compiletime, just like with strings, I implemented basic functions.
class cstring final {
const char* str_;
std::size_t size_;
public:
constexpr cstring(const char* str, std::size_t size, std::size_t pref... |
I have this user controller that follows the repository pattern. It works perfect, but is it easy to understand? Is this good quality work?
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Threading.Tasks;
using AutoMapper;
using DatingApp_API.Data;
using DatingApp_API.DataTra... |
This is a simple "Rock, Paper, Scissors" game I made in Python 3. Feel free to critique me and give suggestions on how can I improve my newbie coding skills.
import os
from random import randint
def ask_player():
while True:
print("Rock, paper or scissors?")
ans = input(">")
if ans in ('Ro... |
Problem
Method getQuoteHTML generates an HTML string using an array returned from getQuoteParams method. They are methods of a large class, UpdateStocks.
Would you be so kind and help me to replace them with faster, easier or more efficient methods, if possible?
getQuoteHTML:
/**
*
* @return a large HTML... |
I am new to Jenkins. I am doing a build through Jenkins, but the build is very slow. Is there any way I can speed it up?
#!/usr/bin/env groovy
@Library('cplib') _
import com.sports.paas.cplib.helpers.Build
import com.sports.paas.cplib.helpers.Workspace
import com.sports.paas.cplib.utils.Openshift
def bld = new Build(... |
I put a solution to this coding problem together. The problem is this:
Create a function that takes an array, finds the most often repeated element(s) within it and returns it/them in an array. The function should work for both integers and strings mixed together within the input list (e.g. [1, 1, "a"]).
If there is a... |
For comparison with other external sorting algorithms, I have implemented external polyphase merge sort, purported to be useful to sort large files that do not fit into main memory. More theoretical info about the algorithm itself can be found here.
My implementation uses a Priority Queue (PQ) as the internal data stru... |
The user selects one of the three categories then makes a note on that selection. Then the note is appended and saved to the appropriate list.
It took me four hours to write this. I'm trying to learn and was wondering if this could be improved or cleaned up at all.
#!/bin/bash
#get the date
date=$(date +%d-%B-%Y)
#sa... |
This code below is what I think should be the implementation of merge sort in Python and it works as expected. It sorts the given list, where we can safely assume that all values are distinct. But after considering some online implementations I am doubtful about mine. So the base question is "Is this even Merge sort?".... |
I have code for a function to calculator the addition of two sorted List. Each element of List is tuple type (xi, yi) that represents graph individual (x,y) points at coordinate system.
two input List is sorted by x value and length of A, B list may be different
[(Ax0, Ay0),..., (Axi, Ayi), (Axi+1, Ayi+1),, ...(Axn,... |
I created a program in python that reads a file and outputs a frequency graph of the words it contains. Any feedback or tips would be appreciated.
from re import split
from collections import Counter
size = int(input("Output window size(in chars): "))
with open("text.txt", "r") as f:
words = [w for w in split(r"[\W... |
The following code attempts to implement memset_s() based on section K.3.7.4.1 of the ISO/IEC 9899:201x N1570 draft:
#include <stdio.h>
#include <string.h>
#include <stdint.h>
errno_t memset_s(void *s,rsize_t smax, int c, rsize_t n)
{
errno_t violation_present = 0;
volatile unsigned char * v = s;
if ( ... |
This program allows users to create and log into their account. The database is created using SQLite3 and the GUI is just simple tkinter boxes. I just want to know how to improve my code, organise it, make it more efficient.
import sqlite3
from tkinter import ttk
import tkinter
from tkinter import messagebox
with sqlit... |
So the problem of verifying if a list is a subsequence of another came up in a discussion, and I wrote code that seems to work (I haven't rigorously tested it).
IsSubequence.py
def is_subsequence(lst1, lst2):
"""
* Finds if a list is a subsequence of another.
* Params:
* `lst1... |
I have a Db table:
'aid' INTEGER,
'tid' INTEGER,
Which represents connection between activity and task, so multiple tasks could be connected to one activity using their ids:
aid tid
1 5
1 9
1 11
So activity with id=1 is connected with tasks with ids=5,9,11.
I load all this data during the launch of the app and ... |
I have an array of some elements that I need to loop through (i.e. execute some block A on each element) but between them I have also to "clean up" (block B) from the previous iteration and that I don't need to clean after the last iteration because B is slow and it is done somewhere further in more efficient way like ... |
I've written a module whose purpose is to allow a user to simply add their email and click 'Save Search'. The details of the search are stored in two straight MySql tables which are not in any way related to the rest of the tables which are used by Drupal.
The class is close to complete (Dotmailer API integration needs... |
I have created a method that is responsible for the creation and the saving of memes. This is a huge mistake because now I need to use 1 of those functionalities (creating) for a different purpose. I tried to divide them into different methods but the code is tightly chained together. For example, when I removed all th... |
I created a little function that returns the elementary values from a flagged enum. By "elementary" I mean the values that are powers of 2, excluding any combined enum values. I was a bit surprised I couldn't find a buit-in method for this in .Net (or I missed it).
Let's take this flagged enum:
[Flags]
public enum Week... |
This is a pre version of my program. This program is about solving exercises. Because this is one of my first graphical applications, I want to know, what can be improved. To this point I usually created command line programs.
You can download the executable here
Main.java
import javafx.application.Application;
import ... |
I am coding a game boy disassembler in C++. The program (simplified here) converts a vector of byte into an assembly instruction and print it.
To do so, it iterates through the vector of bytes (char) with an iterator. I noticed that with the it!=char_vect.end() condition, there is the risk that the iterator goes out f... |
This is not a task, but I want to know what the general consensus is on functional programming. Particularly functional programming in Python.
The two snippets of code I am comparing are the following.
if files:
if isinstance(files, basestring):
pattern_good = check_if_exists(files)
else:
patter... |
Summary
In a block storage system, new data is written in blocks. We are going to represent the flash memory as one sequential array. We have a list of block writes coming in the form of arrays of size 2: writes[i] = [first_block_written, last_block_written].
Each block has a rewrite limit. If rewrites on a block reac... |
So, this is for a clicker game I'm trying to build with Pokémon data drawn from the PokéAPI. Since I'm using Vue.js for the project, Vuex is used to store and share the data between components and I'm persisting and loading the state with LocalForage to IndexedDb.
When constructing a Pokemon-object from the Pokemon-cla... |
We have a department in our org that generates a lot of data in flat files, all with different formats. We are now trying to sort this data out and load into a database. As step 1, I am trying to identify the structure(separator, header, fields, datatypes, etc) of the files using a python script. This is my first time ... |
Background
I got this interview test and got declined due to not meeting their expectations, but never got a reason on what was bad and how they solved it. I want to improve and learn something out of it.
Question
How can this be better written and what is badly written?
Assignment description
To optimize the amount of... |
My below code is the slowest sub in my workbook. I can't set it to put the Array in immediatley, because the mode is calculated incorrectly (calculates for just one site no)
Is there a way to cut this down without breaking the fully functioning code?
Sub ModeColumn()
Dim wb As Workbook, ws As Worksheet, LastRow As Lon... |
I decided to write a little snake game in c++ to practice and as an opportunity to learn ncurses. It turned out to be much bigger than I anticipated but since I've never really written anything big, I'd be really thankful if you could point out more efficient ways or better practices.
main.cpp
#include "ui.hpp"
#includ... |
This is a follow-up to ""Rock, Paper, Scissors" game". I did almost everything the answers recommended and I hope you like it.
import os
from random import choice
def player_choice():
while True:
print("Rock, paper or scissors?")
choice = input(">").capitalize()
if choice in ('Rock', 'Pape... |
This is a simple calculator made in 2/3 hours. I am still new and I was trying out some tags. If you can add some comment and say what to do and what to improve I will be really grateful.
var buttonOne = document.forms.formularzCalc.keyOne;
var buttonTwo = document.forms.formularzCalc.keyTwo;
var buttonThree = docume... |
Today I faced a difficult problem where I needed to step through several totally unrelated classes, and I suspected (among others) an object aliasing problem somewhere deep in the framework layers.
In Eclipse, I had several breakpoints at which I could look at some of the objects and variables. But as soon as the frame... |
Problem:
Consider equations of the form: \$a^2 + b^2 = N; 0 \leq a \leq b; a, b, N \in \mathbb{N}\$.
For \$N=65\$ there are two solutions:
\$a=1, b=8\$ and \$a=4, b=7\$.
We call \$S(N)\$ the sum of the values of \$a\$ of all solutions of \$a^2 + b^2 = N\$.
Thus \$S(65) = 1 + 4 = 5\$.
Find \$\sum S(N)\$, for all square... |
I wrote this algorithm which takes input data from something like a CSV file or a large array that contain a series of String elements in the format of "count, FQDN" and then adds or increments the count of each domain component up to the complete FQDN. For example:
// Sample output (in any order/format):
// getTotalsB... |
I am writing a compiler for esoteric language as one of my first Rust projects. I am using rust-pest to generate a parser. Since I'm new in Rust, code review would be great.
Full source code can be found here.
Here are some code snippets.
Thanks in advance.
ast.rs
use std::rc::Rc as Rc;
#[derive(Debug)]
pub struct Mod... |
I have implemented a simple do/while loop to handle a http request to a third-party. I don’t know when the data I receive will have elements in its array so I retry up to 10 times until the array given to me has data which then I stop and store the data in my database.
My question is in terms of performance is my API g... |
I have the following working code to calculate the potential of a matrix after normalizing the matrix. But it is too much time consuming. Is there a way to make this code run faster?
import csv
import numpy as np
from normalization import normalized_matrix
n = len(normalized_matrix)
sigma = 1
potential_writer = csv.wri... |
Feature requirements.
I can move a square box.
I can resize a square box by stretching four edges.
Many square boxes can exist.
I've implemented moving and resizing square boxes by module pattern. Of course, I thought making a square box as a Class. But I think that using module pattern is better in this case.
Modul... |
I have piece metaled this code together from multiple google searches and thanks to the function from the site mentioned in the code. I am sure there are ways to optimize this for speed. What do you guys suggest?
using System;
using System.Globalization;
public class Program
{
public static void Main()
{
... |
The use case that this code tries to meet is
There will be an interview session where the video calling is done between two participants, interviewer(ER) and interviewee(EE). For this I need to have a video element and reference that video element using ref. For ER its a localStreamRef and for EE its remoteStreamRef. T... |
I have this sorting algorithm which takes an array of dictionary values:
guard var imageUrlString = anyImage.value as? [String:AnyObject] else { return }
I then loop through it, adding the values with the smallest Int key to a new array to be used afterward. Thus the values in this array of AnyObjects would go from 1 ... |
I have an assignment to solve this problem. There are a total of 12 test case files, 1 of which that I have failed due to exceeding limit on the script.
Question Description
Bob has somehow managed to obtain a class list of \$N\$ students that
contains the name of the students, as well as their scores for an
exam... |
Functionality:
This method removes a list of specific terms (e.g., LLC, INC, Inc, Company, etc.) from a list of public companies names. It is part of a class that can be viewed in this link.
I'd appreciate it if you would possibly review it for best coding practices and efficiency.
Method:
/**
*
* @return a string of... |
I implemented a 2D counterpart of std::array named array2d in C++17. It is an aggregate like std::array, and provides similar interface. The goal is that if you know how to use std::array, then you will find yourself at home using array2d. Any comments are welcome :) For better viewing experience with highlighting, you... |
I have created an Angular pipe to suppress the sensitive information like credit cards, bank account, ABA numbers etc.
This is working fine but I would like to know if this is the best possible way to implement the logic.
Here is the Typescript code for pipe logic.
export class SuppressInfoPipe implements PipeTransfor... |
Since C# 8 and .Net Core 3 are going to be released sometime this year, I wanted to try and convert the library I made to make querying databases easier, implementing the already accepted features (using declarations, patterns, ranges, ...).
I'm going to pre-emptively say that parameters aren't here yet, because first ... |
There are no requirements for this project nor will it ever be used for any purpose.
I used this project to cement my knowledge of basic programming skills, I got bored copying the examples and felt I would learn faster if I built everything into a functional program with a little complexity. It follows British regist... |
When generating a string representation of expression trees, I would like to render calls to String.Format with a constant string as the first parameter, as interpolated strings (link). In order to do so, I have to parse the compiler-generated composite format string.
I've written the following function for this purpos... |
I have a solution, which compares 2 given strings and returns the number of total matching characters.
I know I haven't initialized the variables and arrays and that this (correctly) yields warnings. I know the variables aren't self-explanatory as they should be.
function commonCharacterCount($s1, $s2) {
$a = (str... |
I have an assignment to solve this problem. I’m not too sure how permutate works by tracing, just tried on inspiration and it works. This code runs on all provided test cases, but I’m just trying to look for ways of improvement in terms of time efficiency, space efficiency and styling.
Question Description
Bob the Dog... |
I've created a script in Python to log into stackoverflow.com using credentials and fetch the profilename once logged in. I've tried to do it using class. I created the methods within that class in such a way so that they work like chain. Should I stick to this design or there is anything better I can pursue? Whatever ... |
A C# WPF user interface has been developed for the Book Inventory MySQL database previously shown in this question. Since the database had already been developed this was a database first implementation.
I did find that additional stored procedures were necessary to implement the Add Book dialog, due to the table norma... |
I have this code to get the current Timestamp and compute the last timestamp's difference with the current timestamp in minutes. I'm wondering if this can be optimized further for production.
public static Timestamp getTimestamp() {
java.util.Date date= new java.util.Date();
long time = date.getTime(); ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.