• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 07:43
CET 13:43
KST 21:43
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
Weekly Cups (Nov 3-9): Clem Conquers in Canada2SC: Evo Complete - Ranked Ladder OPEN ALPHA7StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7[BSL21] RO32 Group Stage4
StarCraft 2
General
SC: Evo Complete - Ranked Ladder OPEN ALPHA Weekly Cups (Nov 3-9): Clem Conquers in Canada Mech is the composition that needs teleportation t Craziest Micro Moments Of All Time? RotterdaM "Serral is the GOAT, and it's not close"
Tourneys
Constellation Cup - Main Event - Stellar Fest Tenacious Turtle Tussle Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle BW General Discussion BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions Where's CardinalAllin/Jukado the mapmaker?
Tourneys
[Megathread] Daily Proleagues [ASL20] Grand Finals [BSL21] RO32 Group A - Saturday 21:00 CET [BSL21] RO32 Group B - Sunday 21:00 CET
Strategy
Current Meta PvZ map balance How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread Should offensive tower rushing be viable in RTS games? Path of Exile Dawn of War IV
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Dyadica Gospel – a Pulp No…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1892 users

The Big Programming Thread - Page 858

Forum Index > General Forum
Post a Reply
Prev 1 856 857 858 859 860 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
plasmidghost
Profile Blog Joined April 2011
Belgium16168 Posts
Last Edited: 2017-03-08 00:40:26
March 07 2017 23:56 GMT
#17141
On March 08 2017 07:20 ShoCkeyy wrote:
Show nested quote +
On March 08 2017 06:46 plasmidghost wrote:
I'm working further on client-server communications and am stuck on this program. I'm trying to have three clients send an integer to a server, along with a private FIFO name so that the server can output the sum of integers from all three clients through the private FIFO that the client named. How do I even do that? I am totally lost. Everything I look at online is not even close to what I'm looking for.
+ Show Spoiler [Client code] +
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <time.h>

struct output
{
char privateFIFO[14];
int getpid;
int integer;
int sum;
}
inst;

main(void)
{
int read_from_client;
int privateFIFO;
struct output;

printf("Input a name for your FIFO (up to 14 characters): ");
fgets(inst.privateFIFO, 15, stdin);
printf("\nFIFO name is %s", inst.privateFIFO);

printf("Input an integer: ");
scanf("%d", &inst.integer);

write(read_from_client, &inst, sizeof(inst));

if ((mkfifo("inst.privateFIFO",0666)<0 && errno != EEXIST))
{
perror("cant create FIFO1");
exit(-1);
}

read(privateFIFO, &inst, sizeof(inst));

printf("The sum of all integers received by the server is %d", inst.sum);

return 0;
}

+ Show Spoiler [Server code] +
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>

struct output
{
char privateFIFO[14];
int getpid;
int integer;
int sum;
}
inst;

main(void)
{
int read_from_client;
int i;
struct output;
int sum[3];
char tmp1[14];
char tmp2[14];
char tmp3[14];

for(i < 0; i < 3; i++) //should read from the clients and write the integers to an array
{
read(read_from_client, &inst, sizeof(inst));
inst.integer = sum[i];
if(i == 0) //should write the private FIFO names to separate arrays
{
tmp1 = inst.privateFIFO;
}
else if(i == 1)
{
tmp2 = inst.privateFIFO;
}
else
{
tmp3 = inst.privateFIFO;
}
}

inst.sum = sum[0] + sum[1] + sum[2]; //the integer

write(tmp1, &inst, sizeof(inst)); //this should send out the sum to each client via a private array, no idea how to make it work
write(tmp2, &inst, sizeof(inst));
write(tmp3, &inst, sizeof(inst));
}



Sounds like you're trying to do a PING POST system? I worked a ton with LeadMesh, and their ping post system. http://stackoverflow.com/questions/12992653/what-is-a-ping-post

I actually completely forgot to mention that I was working in C, I have no idea what that is, unfortunately.
My current issue is that the client and server compile, but when I run the client, nothing prompts and I have to force close it.
Anyways, updated code, should be better to see now:
+ Show Spoiler [Client code] +
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <time.h>

struct input
{
char privateFIFO[14];
int getpid;
int integer;
}
fromClient;

struct output
{
int sum;
}
toClient;

main(void)
{
int read_from_client;
int write_to_client;
int i;
struct output;

if((read_from_client=open("FIFO1", O_WRONLY))<0)
printf("cant open fifo to write");

if((write_to_client=open("FIFO2", O_RDONLY))<0)
printf("cant open fifo to read");

fromClient.getpid = rand()%100000;
printf("Your process ID is: %d", fromClient.getpid);

printf("Input a name for your FIFO (up to 14 characters): ");
fgets(fromClient.privateFIFO, 15, stdin);
sprintf(fromClient.privateFIFO, "FIFO_%d", fromClient.getpid);
printf("\nFIFO name is %s", fromClient.privateFIFO);

printf("Input an integer: ");
scanf("%d", &fromClient.integer);

write(read_from_client, &fromClient, sizeof(fromClient));

read(write_to_client, &toClient, sizeof(toClient));

printf("The sum of all integers received by the server is %d", toClient.sum);

close(read_from_client);
close(write_to_client);
}

+ Show Spoiler [Server code] +
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>

struct input
{
char privateFIFO[14];
int getpid;
int integer;
}
fromClient;

struct output
{
int sum;
}
toClient;

main(void)
{
int read_from_client;
int i;
struct output;
int sum[3];
int write_to_client[3];
char fifo[3][14];

/* Create the fifos and open them */
if ((mkfifo("FIFO1",0666)<0 && errno != EEXIST))
{
perror("cant create FIFO1");
exit(-1);
}

if ((mkfifo("FIFO2",0666)<0 && errno != EEXIST))
{
perror("cant create FIFO2");
exit(-1);
}

if((read_from_client=open("FIFO1", O_RDONLY))<0)
printf("cant open fifo to read");

toClient.sum = 0;

for(i = 0; i < 3; i++)
{
read(read_from_client, &fromClient, sizeof(fromClient));
strcpy(fifo[i], fromClient.privateFIFO);

if((write_to_client[i]=open(fromClient.privateFIFO, O_WRONLY))<0)
printf("cant open fifo to write");

printf("Server: Just got an integer.\nClient sent the integer %d", fromClient.integer);

toClient.sum = toClient.sum + fromClient.integer;
}

for(i = 0; i < 3; i++)
{
write(write_to_client[i], &toClient, sizeof(toClient));
close(write_to_client[i]);
unlink(fifo[i]);
}
}
Yugoslavia will always live on in my heart
Thaniri
Profile Blog Joined March 2011
1264 Posts
Last Edited: 2017-03-08 03:08:08
March 08 2017 03:07 GMT
#17142
@Manitou I frankly have no idea. I am such a novice that I don't even know about the things I don't know.

Thanks for the link though!!
DickMcFanny
Profile Blog Joined September 2015
Ireland1076 Posts
March 08 2017 08:16 GMT
#17143
Do you guys think one could create a game that runs natively in every HTML5 browser at the complexity of the SNES Zelda with controller support?
| (• ◡•)|╯ ╰(❍ᴥ❍ʋ)
Hanh
Profile Joined June 2016
146 Posts
March 08 2017 10:23 GMT
#17144
There is a snes emulator in Javascript that can run Zelda.
Manit0u
Profile Blog Joined August 2004
Poland17426 Posts
Last Edited: 2017-03-08 15:24:25
March 08 2017 14:50 GMT
#17145
http://naildrivin5.com/blog/2012/07/17/adventures-in-functional-programming-with-ruby.html

[image loading]

And another good thing:
http://naildrivin5.com/blog/2013/05/17/source-code-typography.html

Especially for people doing JavaScript...

The most important part of a variable declaration is the name of the variable (the second being its default value). Putting a comma first creates at typographic roadblock between the reader and the information they need (the variable name). That a comma is required between variable declarations is one of the least important pieces of information in this code, yet it’s front and center. This is bad typography.


Whoever invented this "comma first" stuff is evil.
Time is precious. Waste it wisely.
waffelz
Profile Blog Joined June 2012
Germany711 Posts
Last Edited: 2017-03-08 20:02:02
March 08 2017 20:01 GMT
#17146
Can someone recommend a good ARM-emulator, preferably with some tools to inspect memory etc, support of C would be nice too but not a must. OS would be preferably windows, but linux would work too.
RIP "The big travis CS degree thread", taken from us too soon | Honourable forum princess, defended by Rebs-approved white knights
Nesserev
Profile Blog Joined January 2011
Belgium2760 Posts
March 08 2017 20:57 GMT
#17147
--- Nuked ---
BluzMan
Profile Blog Joined April 2006
Russian Federation4235 Posts
March 08 2017 22:09 GMT
#17148
On March 08 2017 23:50 Manit0u wrote:
http://naildrivin5.com/blog/2012/07/17/adventures-in-functional-programming-with-ruby.html

[image loading]

And another good thing:
http://naildrivin5.com/blog/2013/05/17/source-code-typography.html

Especially for people doing JavaScript...
Show nested quote +

The most important part of a variable declaration is the name of the variable (the second being its default value). Putting a comma first creates at typographic roadblock between the reader and the information they need (the variable name). That a comma is required between variable declarations is one of the least important pieces of information in this code, yet it’s front and center. This is bad typography.


Whoever invented this "comma first" stuff is evil.


God, please never ever do this in production code:
Let’s re-set the argument list, aligning like with like, forming a table structure


Anyone who thought of that never thought of using a VCS to merge stuff or auto-refactoring tools or even just manually renaming a variable. It's such a horrible habit people have despite any good styleguide (such as PEP8) explicitly recommending against it. Code is not there to look pretty, whitespace longer than one space should be used for indentation purposes only.

Also, commas in javascript are the saddest thing ever. Starting as an Internet Explorer parser bug, the lack of trailing comma in array definitions inexplicably made it's way into the JSON standard, giving literal thousands of people nightmares about VCS conflict resolution, turning an innocent "me and that other Joe both added an item to the same array, what could go wrong?" situation into a syntax error after the merge. I'm still amazed how this got silently accepted by everyone.
You want 20 good men, but you need a bad pussy.
shz
Profile Blog Joined October 2010
Germany2687 Posts
March 08 2017 22:13 GMT
#17149
At least it will be fixed in ES2017: http://www.2ality.com/2016/02/ecmascript-2017.html
Liquipedia
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
March 08 2017 22:18 GMT
#17150
I ended up going to that amazon coding assessment/interview thing.

It came in 3 stages. First stage was easy, it was debugging various snippets with a short time limit. Clearly for weeding out. I aced it, I am sure most people did too. Second part was also easy. 24 logic puzzles. I doubt I missed many. Unfortunately I do know I missed one because I realized I misread it after I submitted it.

3rd part I kinda botched. It was 2 coding questions and you got 70 minutes total. First question I got right except I was only passing 15 out of 18 test cases.. not sure why, I must have not read the question closely enough. I decided to move on to the 2nd question and come back to question 1 if I had time. Second question, I understood the question - and had an idea of how to do it. But I think I didn't plan properly, and I committed to a poor plan and wasn't willing to scrap it. And I tried to hack my bad code to make it work and I wasn't able to solve my bugs in the time limit. So I ended up completely failing on the 2nd coding question despite understanding how I could solve it.

Oh well! I actually came in expecting to get my ass kicked. Most of the students there were going into senior year next year. Next time I have an assessment like this I am sure i will do much better.
Manit0u
Profile Blog Joined August 2004
Poland17426 Posts
March 08 2017 22:19 GMT
#17151
On March 09 2017 07:13 shz wrote:
At least it will be fixed in ES2017: http://www.2ality.com/2016/02/ecmascript-2017.html


Not a fan of trailing commas in function arguments though. It introduces some uncertainty when reading code (does this function take any more parameters? Are they set to null this way? Did someone forget or accidentally removed something?).
Time is precious. Waste it wisely.
BluzMan
Profile Blog Joined April 2006
Russian Federation4235 Posts
March 08 2017 23:10 GMT
#17152
On March 09 2017 07:13 shz wrote:
At least it will be fixed in ES2017: http://www.2ality.com/2016/02/ecmascript-2017.html

Lol why would JS need atomics haha. Strange times we live in.
You want 20 good men, but you need a bad pussy.
plasmidghost
Profile Blog Joined April 2011
Belgium16168 Posts
Last Edited: 2017-03-08 23:25:42
March 08 2017 23:25 GMT
#17153
In C, is it possible to declare a FIFO name as a string name stored in a struct and not directly named? I keep trying to create it and keep getting the error statement in the second block of code
How I normally make a FIFO:
if((mkfifo("commonFIFO",0666)<0 && errno != EEXIST))
{
perror("cant create commonFIFO");
exit(-1);
}

if((read_from_client=open("commonFIFO", O_RDONLY))<0)
printf("cant open fifo to read");

How I want to make a FIFO (the FIFO name isn't in quotations, it is being taken from a string name stored in a struct):
if((mkfifo(fromClient.privateFIFO,0666)<0 && errno != EEXIST))
{
perror("cant create privateFIFO");
exit(-1);
}

if((write_to_client=open(fromClient.privateFIFO, O_WRONLY))<0)
printf("cant open fifo to write");
Yugoslavia will always live on in my heart
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2017-03-09 00:34:53
March 09 2017 00:04 GMT
#17154
There's no difference as long as the char array is terminated by a null character.

If you're reading the struct from read, or any network interface, you don't have that guarantee, so you have to sanitize the input. This is done by either force-writing a null character to the end, or reading only the char array into a buffer that you know is terminated with a null character.

Reading your client code, you initialize a size 14 array and then fgets 14 characters + 1 null character, which is beyond the end of the array, but then you also overwrite that array with a string? You also never open privateFIFO in your client so your server never unblocks.

https://linux.die.net/man/3/mkfifo

Once you have created a FIFO special file in this way, any process can open it for reading or writing, in the same way as an ordinary file. However, it has to be open at both ends simultaneously before you can proceed to do any input or output operations on it. Opening a FIFO for reading normally blocks until some other process opens the same FIFO for writing, and vice versa. See fifo(7) for nonblocking handling of FIFO special files.


You should really also,
declare struct variables (fromClient, toClient) locally instead of statically
declare main with the correct return type (int)
use functions to compartmentalize functionality
use a common header file to share code between the files
There is no one like you in the universe.
plasmidghost
Profile Blog Joined April 2011
Belgium16168 Posts
Last Edited: 2017-03-09 02:25:39
March 09 2017 02:18 GMT
#17155
On March 09 2017 09:04 Blisse wrote:
There's no difference as long as the char array is terminated by a null character.

If you're reading the struct from read, or any network interface, you don't have that guarantee, so you have to sanitize the input. This is done by either force-writing a null character to the end, or reading only the char array into a buffer that you know is terminated with a null character.

Reading your client code, you initialize a size 14 array and then fgets 14 characters + 1 null character, which is beyond the end of the array, but then you also overwrite that array with a string? You also never open privateFIFO in your client so your server never unblocks.

https://linux.die.net/man/3/mkfifo

Show nested quote +
Once you have created a FIFO special file in this way, any process can open it for reading or writing, in the same way as an ordinary file. However, it has to be open at both ends simultaneously before you can proceed to do any input or output operations on it. Opening a FIFO for reading normally blocks until some other process opens the same FIFO for writing, and vice versa. See fifo(7) for nonblocking handling of FIFO special files.


You should really also,
declare struct variables (fromClient, toClient) locally instead of statically
declare main with the correct return type (int)
use functions to compartmentalize functionality
use a common header file to share code between the files

I ended up reworking the code greatly and simplifying it in some ways,it's actually now going to take a running sum for x number of clients. For each client that inputs one number, it will receive the current sum of all the numbers the server has received from the clients. I removed the option for a private FIFO name to be inputted by the client so that there wouldn't be any collisions if, for instance, two clients inputted the same name, and replaced it with a constant 10-character string. I made the array size 11
+ Show Spoiler [Client code] +
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>

struct input
{
char privateFIFO[11];
int clientID;
int number;
}
fromClient;

struct output
{
int sum;
}
toClient;

main(void)
{
int read_from_client;
int write_to_client;
int i;

memset(fromClient.privateFIFO, 0, 11);

if((read_from_client=open("commonFIFO", O_WRONLY))<0)
printf("cant open fifo to write");

fromClient.clientID = getpid();
sprintf(fromClient.privateFIFO, "FIFO_%d", fromClient.clientID);
printf("\nFIFO name is %s", fromClient.privateFIFO);

printf("\nInput an integer: ");
scanf("%d", &fromClient.number);

write(read_from_client, &fromClient, sizeof(fromClient));

if((write_to_client=open(fromClient.privateFIFO, O_RDONLY))<0)
printf("cant open fifo to read");

read(write_to_client, &toClient, sizeof(toClient));

printf("The current sum of all integers is %d", toClient.sum);

close(read_from_client);
close(write_to_client);
}

+ Show Spoiler [Server code] +
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>

struct input
{
char privateFIFO[11];
int getpid;
int number;
}
fromClient;

struct output
{
int sum;
}
toClient;

main(void)
{
int read_from_client;
int i;
int write_to_client;
int number_of_clients;

memset(fromClient.privateFIFO, 0, 11);

printf("How many clients are there? ");
scanf("%d", &number_of_clients);

/* Create the fifos and open them */
if((mkfifo("commonFIFO",0666)<0 && errno != EEXIST))
{
perror("cant create commonFIFO");
exit(-1);
}

if((read_from_client=open("commonFIFO", O_RDONLY))<0)
printf("cant open fifo to read");

toClient.sum = 0;

for(i = 0; i < number_of_clients; i++)
{
read(read_from_client, &fromClient, sizeof(fromClient));

if((mkfifo(fromClient.privateFIFO,0666)<0 && errno != EEXIST))
{
perror("cant create privateFIFO");
exit(-1);
}

if((write_to_client=open(fromClient.privateFIFO, O_WRONLY))<0)
printf("cant open fifo to write");

printf("Server: Just got the number %d", fromClient.number);

toClient.sum = toClient.sum + fromClient.number;

printf("\nServer: Current sum is %d", toClient.sum);

write(write_to_client, &toClient, sizeof(toClient));
close(read_from_client);
close(write_to_client);
}
}
Yugoslavia will always live on in my heart
Neshapotamus
Profile Blog Joined May 2006
United States163 Posts
Last Edited: 2017-03-09 07:35:07
March 09 2017 07:29 GMT
#17156
Take backs, been fighting the flu.
Wrath
Profile Blog Joined July 2014
3174 Posts
March 09 2017 12:41 GMT
#17157
On March 09 2017 07:18 travis wrote:
I ended up going to that amazon coding assessment/interview thing.

It came in 3 stages. First stage was easy, it was debugging various snippets with a short time limit. Clearly for weeding out. I aced it, I am sure most people did too. Second part was also easy. 24 logic puzzles. I doubt I missed many. Unfortunately I do know I missed one because I realized I misread it after I submitted it.

3rd part I kinda botched. It was 2 coding questions and you got 70 minutes total. First question I got right except I was only passing 15 out of 18 test cases.. not sure why, I must have not read the question closely enough. I decided to move on to the 2nd question and come back to question 1 if I had time. Second question, I understood the question - and had an idea of how to do it. But I think I didn't plan properly, and I committed to a poor plan and wasn't willing to scrap it. And I tried to hack my bad code to make it work and I wasn't able to solve my bugs in the time limit. So I ended up completely failing on the 2nd coding question despite understanding how I could solve it.

Oh well! I actually came in expecting to get my ass kicked. Most of the students there were going into senior year next year. Next time I have an assessment like this I am sure i will do much better.


I like puzzels. Could you please share some?
bardtown
Profile Joined June 2011
England2313 Posts
March 09 2017 12:59 GMT
#17158
Is there anybody with tensorflow experience who wouldn't mind answering a few PMs? I'm trying to create a simple neural network but can't figure out how to preprocess and feed my data how it wants it.
Deleted User 3420
Profile Blog Joined May 2003
24492 Posts
March 09 2017 16:56 GMT
#17159
On March 09 2017 21:41 Wrath wrote:
Show nested quote +
On March 09 2017 07:18 travis wrote:
I ended up going to that amazon coding assessment/interview thing.

It came in 3 stages. First stage was easy, it was debugging various snippets with a short time limit. Clearly for weeding out. I aced it, I am sure most people did too. Second part was also easy. 24 logic puzzles. I doubt I missed many. Unfortunately I do know I missed one because I realized I misread it after I submitted it.

3rd part I kinda botched. It was 2 coding questions and you got 70 minutes total. First question I got right except I was only passing 15 out of 18 test cases.. not sure why, I must have not read the question closely enough. I decided to move on to the 2nd question and come back to question 1 if I had time. Second question, I understood the question - and had an idea of how to do it. But I think I didn't plan properly, and I committed to a poor plan and wasn't willing to scrap it. And I tried to hack my bad code to make it work and I wasn't able to solve my bugs in the time limit. So I ended up completely failing on the 2nd coding question despite understanding how I could solve it.

Oh well! I actually came in expecting to get my ass kicked. Most of the students there were going into senior year next year. Next time I have an assessment like this I am sure i will do much better.


I like puzzels. Could you please share some?


I can't because you have to sign a non-disclosure agreement and I am going to honor that. But I will tell you that they were not particularly hard, the only hard thing about them is solving them without making errors within the time limit. You wouldn't be particularly satisfied with them - any of us here would be able to answer them given enough time.
Blisse
Profile Blog Joined July 2010
Canada3710 Posts
Last Edited: 2017-03-09 20:09:26
March 09 2017 20:09 GMT
#17160
On March 09 2017 21:41 Wrath wrote:
Show nested quote +
On March 09 2017 07:18 travis wrote:
I ended up going to that amazon coding assessment/interview thing.

It came in 3 stages. First stage was easy, it was debugging various snippets with a short time limit. Clearly for weeding out. I aced it, I am sure most people did too. Second part was also easy. 24 logic puzzles. I doubt I missed many. Unfortunately I do know I missed one because I realized I misread it after I submitted it.

3rd part I kinda botched. It was 2 coding questions and you got 70 minutes total. First question I got right except I was only passing 15 out of 18 test cases.. not sure why, I must have not read the question closely enough. I decided to move on to the 2nd question and come back to question 1 if I had time. Second question, I understood the question - and had an idea of how to do it. But I think I didn't plan properly, and I committed to a poor plan and wasn't willing to scrap it. And I tried to hack my bad code to make it work and I wasn't able to solve my bugs in the time limit. So I ended up completely failing on the 2nd coding question despite understanding how I could solve it.

Oh well! I actually came in expecting to get my ass kicked. Most of the students there were going into senior year next year. Next time I have an assessment like this I am sure i will do much better.


I like puzzels. Could you please share some?


5-minute hard limit. Time yourself.

Find the longest palindromic substring in a list of strings.

For example, given strings: "carracecar", "aabbaa", "aabbbabab", return either "racecar" or 7.
There is no one like you in the universe.
Prev 1 856 857 858 859 860 1032 Next
Please log in or register to reply.
Live Events Refresh
WardiTV Korean Royale
12:00
Group Stage 1 - Group B
WardiTV682
TKL 279
Rex110
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
TKL 279
RotterdaM 234
Lowko207
SortOf 125
Rex 110
StarCraft: Brood War
Calm 6256
Hyuk 2587
Soma 508
Stork 414
ZerO 343
Pusan 227
Rush 130
Barracks 126
hero 118
Killer 95
[ Show more ]
sSak 84
Sharp 73
Noble 42
ToSsGirL 42
Aegong 40
Backho 39
zelot 37
Free 33
Icarus 26
Movie 21
Shine 18
Sexy 16
Terrorterran 14
sas.Sziky 1
Dota 2
Dendi583
XaKoH 452
XcaliburYe208
BananaSlamJamma48
Counter-Strike
olofmeister1886
byalli526
edward19
Other Games
B2W.Neo1129
DeMusliM303
crisheroes289
Pyrionflax216
Sick211
ZerO(Twitch)4
Organizations
StarCraft: Brood War
lovetv 13
StarCraft 2
IntoTheiNu 1
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• Adnapsc2 5
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota238
Upcoming Events
OSC
3h 17m
Replay Cast
10h 17m
Replay Cast
20h 17m
Kung Fu Cup
23h 17m
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
1d 10h
The PondCast
1d 21h
RSL Revival
1d 21h
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
1d 23h
WardiTV Korean Royale
1d 23h
PiGosaur Monday
2 days
[ Show More ]
RSL Revival
2 days
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
2 days
CranKy Ducklings
3 days
RSL Revival
3 days
herO vs Gerald
ByuN vs SHIN
Kung Fu Cup
3 days
BSL 21
4 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
4 days
RSL Revival
4 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
4 days
WardiTV Korean Royale
4 days
BSL 21
5 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
Wardi Open
5 days
Monday Night Weeklies
6 days
WardiTV Korean Royale
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.