I need to compute the max contiguous slice in an array. I wrote this function, but I am not sure if it is correct or I am missing edge cases. I ran several cases.
def max_slice(a)
max_start,max_end = 0,0
largest_sum = 0
curr_start,curr_end = 0,0
curr_sum = 0
for i in 0..a.length-1
...
14 year old kid here. I just began my C# debut i was just wondering if this is good and flexible code it's just a rock paper scissor console app. If there is anyway this could be better please tell me.
abstract class Participant //Abstract - no need for instances, Many common functionality
...
Tomorrow morning at 10AM EDT (14:00 UTC), we will begin moving all services from our New York data center to Denver, CO. Last Saturday was the read-only test in preparation for this move. It’s a fire sale and everything must go! The major user-facing services that will be involved in the move are: All Q&A Sites (including Stack Overflow) Stack Overflow CareersChatBlogsStack Exchange APIstac…
Heads up: we will be doing a failover of all services to our DR data center tomorrow to prep for network maintenance. http://stackstatus.net/post/126135656099/data-center-failover-august-8-2015
basically, im almost finished coding my entire website in dreamweaver. however when i got on today it started saying "unexpected end-of-file" on line 192. before today everything including the database worked perfectly, idk what happened!
this is a password recovery program i made and just want it checked out.
this isn't all the files for the login and register only the password recovery part. the columns in the table user are id, username, password, salt, passres, and passexp. passres is the reset token, passexp is the expiration...
I've created this simple 3D voxel terrain generator using Perlin Noise. I have a few concerns about it though.
Is there any way to make it more performant? It currently takes ~1.5 seconds to generate a 200x200 map.
Am I splitting up the different "jobs" of the generator correctly?
Is my general...
@rolfl: Oh, I just remembered that you wanted me to remind you about IBM jobs! I remembered as soon as I got an email from Glassdoor regarding IBM jobs.
Sorry i could not help laughing throughout your post. The only thing i have to disagree with is changing Choice to a nullable type too much nullable type casting yo. Explain why Game_Info should be a class and why rock,paper,scissor variables should be taken out. You're forgetting i am a freaking 14 year old when i come to this code later on i am sure it's simple enough for me to figure out what it does. — fun Tertain13 mins ago
The variables are just redundant, they add an unneeded layer of indirection vs. using the plain enum values. Game_Info being a mutable struct defies all best practices about value types, and ignoring that will inevitably come and bite you somewhere, some day. As for the nullable, it's semantically what's right to do (absence of a meaningful value is a null value, not some "special" valid value), and the worries about too much casting are injustified, since Nullable<T> has implicit conversion to T, so there's no need to explicitly cast anything. Welcome to CR, glad you enjoyed! — Mat's Mug ♦47 secs ago
Which reminds me: I should take a look at my Bejeweled code again and see if I can still understand it. Then again, I've been meaning to redo it from the beginning.
I'm struggling with making my library work as a CocoaPod and would appreciate any assistance that points me in the correct direction.
I've never made a Pod before, and I feel like I've got everything right to the point that this would work... if it were a simple pod with just uncompiled .h/.m/.s...
@rolfl: Also, I just applied for another (different) developer position at IBM. I fit all of the language requirements, but not so much the hardware ones. It doesn't require a Bachelor's degree, either.
I am trying to Solve this Problem
Statement:
For a given sequence A(A1,A2……AN), your task is to find the sum S of the minimum elements of all the possible contiguous sub-sequences of A
Example:
1 2 3
Possible contiguous sub sequences {(1),(2),(3),(1,2),(1,2,3),(2,3)}
Sum of minimum elements =...
I am looking for a better/ more efficient way to architect this piece of code
I have Clips that can be added to or removed from any number of Lines. When I add the Clip, I put it into a ClipHolder so I can keep some bounds information with it which is specific to the Line / Clip relationship.
T...
hi im learning to do html and im stuck on this: In the body section, create a heading. To do this, create an tag.
Add content.
Close the element with a closing tag . (Your content should now be between and .)
Underneath the heading tags, create two paragraphs using tags with whatever content y...
I have written a basic C Shell. It features the builtins cd, programmer, ver and exit. The code for the shell, named vsh, is as follows:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#define BUFSIZE 1024
#define TOK_BUFSIZE 64
#define TOK_D...
I have created a game called 'runes' in C. It is similar to chess, but has a bigger board and different pieces. I would like to know how to improve the code, for example, adding proper error checking, and also to solve any bugs. (This is probably not called 'broken code' because the main function...
Depending on how it plays out, we may actually get a fifth moderator without another election round — Vogel61213 hours ago
That rumour has been around for a while, but as far as I know it could take as long as it took us to graduate (if we actually did, the 'beta' is still in our title bar) to get a 5th moderator (if we get one at all).
Not to offend anyone, but SE's decision cycle is very unpredictable and usually slow (lately).
A n*n grid is having some filled blocks and some empty ones. We have to select a k x n grid (k <= n) by removing the filled blocks. What are the minimum number of blocks needed to be removed.
Input
Values of n and k will be provided with further n lines denoting the contiguous segment of blocks...
I went to sleep at 6 a.m. We had a concert last night and I had to drive home, which took between 1h30 and 2h. Not what I like the most, but at least I got to wake up at home.
I have implemented the dining philosophers problem in clojure which refs, trying to emphasize readability. Please point out if parts of it are inefficient, not idiomatic, or improvable in any way.
;;;;;;;;;;;;;;;;;;;;
;; DINING ;;
;; PHILOSOPHERS ;;
;; PROBLEM ;;
;;;;;;;;;;;;;;;...
I'm struggling with making my library work as a CocoaPod and would appreciate any assistance that points me in the correct direction.
I've never made a Pod before, and I feel like I've got everything right to the point that this would work... if it were a simple pod with just uncompiled .h/.m/.s...
While understanding the MVC pattern, I came across this particular article. I thought to implement it using the C++/QT library.
The intent over here is to implement/use MVC concepts in correct way. Awaiting the feedback/review comments from community.
model.h
#ifndef MODEL_H
#define MODEL_...
I am solving the following problem:
You are given two lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a list.
I wrote the following code:
let addTwoNumbers (a: int list)...
There are few discussions for [ruby-on-rails][migration][seed] and so why I voted up. I'm no expert but try what you have and then see what a better question might be. You could try code review also for this type of question. I got redirected there once for a question like this. I suggest just seeing if it has problems first then ask for help. You might get better responses. IMHO Thanks for the topic though. — Douglas G. Allen5 secs ago
hi im learning to do html and im stuck on this: In the body section, create a heading. To do this, create an tag.
Add content.
Close the element with a closing tag . (Your content should now be between and .)
Underneath the heading tags, create two paragraphs using tags with whatever content y...
I'm voting to close this question as off-topic because it's not a question, but a request for code review, that belongs to codereview.stackexchange.com — JB Nizet31 secs ago
@Morwenn This is the same code, golfed: r=f=>f.toLowerCase().replace(/[^a-z\d]/g,'').split('').sort().join(''),t=this,t.isAnagram=f(t.word1)==f(t.word2); (ES6)
@EthanBierlein Removing the bad drivers and re-installing the drivers, downloaded from the official website (either the manufacturer of your laptop or of the device) usually fixes problems
I already answered here, but I realized that this question should've probably been posted to (codereview.stackexchange.com)[codereview.stackexchange.com]. — Markus Meskanen39 secs ago
Netbeans IDE 8.0.1 : Jframe
I'm just new at programming, only few weeks of experience.
I have a Combo box that has three items : Manager, Supervisor, Employee.
I have a Text field that will show the rate if I chose one of the following.
If I chose Manager then Rate = 500, Supervisor - 400, Em...
I am prepping for a junior level interview in C#. I am hoping I can get some feedback on how to improve my code to print the most common occurrence of an int in an array.
using System;
using System.Collections;
namespace FrequentInt
{
class MainClass
{
static void CommomOcurr...
This Script will make it so that you are notified on the Desktop whenever new reviews are available, as long as you have a review tab open.
How to use
Install Greasemonkey (Firefox) or Tampermonkey (Chrome). These are userscript managers and allow the script to make use of GM_* functions
Insta...
> “But where is your .Net experience. All I see is this open source project. Don’t you have any real experience?” Even now, months later, that statement makes my blood boil.
not only open-source is "real" experience, if it's a significant contribution, then it's at least a magnitude better than closed-source professional experience
@Mat'sMug maybe I misunderstood you. A BS is not a requirement for hiring programmers. I meant, I know programmers with BS and MS degrees who are happy coding crap and not trying to be better
That's another problem too: most other programmers I know who hire programmers are completely clueless when it comes to evaluating candidates. They don't know what they are doing. They could know, if they researched it a little bit
@RubberDuck just like the clueless HR guy filtered you out, you also filtered them out. You really don't want to work at a place where they don't recognize the value of your contributions. It's good to be picky
Overlapping and hiding controls instead of creating new ones, thousands of lines of code (the whole app) shoved into one form's code behind file... insanity
I have a project where I'm to implement a DFS using a direct graph. The implementation should print the currently visited vertex, the parent (the node from which the current node was reached), and the discovery and finish time for each node.
Using these graph values:
int[] vertices = {1,2,3,4,5...
@RubberDuck speaking of architecture... I'm looking for where the code pane context menu is being initialized... and I can't find it. that cleanup is waaaaay past due...