Questions tagged [problem-solving]

Problem solving encompasses a number of techniques known as algorithms, heuristics, root cause analysis, etc.

Filter by
Sorted by
Tagged with
2 votes
1 answer
96 views

How to manage cart details across various devices

Recently I was asked in a interview to implement to e-commerce site . One of the requirement was to maintain cart details across various devices .(i.e) if user adds a book from his iPhone , and when ...
6 votes
1 answer
798 views

Algorithm for floor tiling

I'm looking for an algorithm for placing tiles of different sizes within a complex area (all 2D) as randomly but efficiently as possible. I know the different dimensions of the tiles provided and the ...
-1 votes
2 answers
125 views

How to measure how "changy" something is? [closed]

I need to think of a way to model how one thing is more "changy" than another. Say I need to index a news website's different news sections with some web crawler. I want to prioritise ...
34 votes
9 answers
2k views

Abstraction: The War between solving the problem and a general solution [closed]

As a programmer, I find myself in the dilemma where I want make my program as abstract and as general as possible. Doing so usually would allow me to reuse my code and have a more general solution ...
0 votes
4 answers
339 views

The problem of letting the receiver instead of the sender generate an ID

Lately I've encountered a similar problem in a few different circumstances, and every time it has required quite a bit of extra code to work around it. The problem I'm talking about is the one where ...
1 vote
0 answers
157 views

Rectangle packing / Bin packing with multiple frames

I have multiple rectangular frames, with different fixed heights. The width should be minimized and there is a maximum width. Then there are many different smaller rectangles. These should be packed ...
1 vote
2 answers
368 views

Help to simplify/model complex decision making (if, then, else scenarios)

I find my self in a situation, where I need to program a service, that can determine if two object in a huge database are the same. For simplicity, let's say it's used cars, and I want to determine if ...
40 votes
10 answers
2k views

Where do you draw the line for your perfectionism? [closed]

Perfectionism may be good and bad when programming. When and where do you draw the line when you are problem solving? When do you decide when a solution is overkill, too general or simply too ...
1 vote
1 answer
217 views

Which class of problems is this?

I’m working on a problem which I will try my best to describe: You have a stack of 5 blocks: labelled A, B, C, D and E. You also have a set of rules giving points if certain conditions are met, for ...
7 votes
1 answer
476 views

Smallest Rubik's cube state representation

I'm trying to determine what is the fewest number of bits I need to represent the state of a Rubik's cube. (EDIT: I am assuming the cube is a valid Rubik's cube that has not been altered and only ...
0 votes
1 answer
127 views

How to identify rules satisfying a certain condition based on events

I am working on a microservice, in an event driven world, where I have tens of 1000s of rules configured which depend on data type A, B, C, D and so on. As soon as an event arrives I want to be able ...
5 votes
3 answers
2k views

How to detect root cause of problem or bug [closed]

Often in coding, I find it very slow and difficult to detect the root cause of a bug and sometimes I end up going to wrong point in my code. It's painful. I know that to detect the root cause of a bug ...
5 votes
4 answers
2k views

What is a good way to brainstorm algorithms on a computer? [closed]

I'm looking for something that allows me to work out an algorithm on a computer similar to how I would do it on a whiteboard. At work, I have a huge whiteboard that I can use for this, but at home, I ...
0 votes
1 answer
147 views

How to resolve multiple user serve on multiple location appointment booking system

I'm trying to build an appointment system but at one point I stuck Problem: I define available slots for the next 7 days with help of a cron. I have multiple users serve service more than one ...
3 votes
4 answers
2k views

Optimistic & Pessimistic Programming - Ensuring multiple tasks are called only once for specific record

Let's say you have 10 database records which you need to process in the following way: Start Pull 2 records from the database with the 'Processed' flag set to 'false' Call the external web service ...
-2 votes
1 answer
206 views

a valid ranking algorithm for facebook posts

I'm creating a website which will collect posts from facebook's pages to show to the users posts they are interested in (as my graduating project). I'd like to be able to rank the posts that contain ...
1 vote
2 answers
161 views

Determining resource exhaustion beforehand

I guess this is a problem solving question but I am out of ideas, don't really know where else I can resort for help, and I need to solve this problem. Essentially we have a set of consumers and a ...
10 votes
6 answers
3k views

How to save during real-time collaboration

I want multiple users to edit same document. Problem I'm facing is when a new user joins, he might see an outdated document. How do I make sure that new users get most recent changes? Some solutions ...
2 votes
1 answer
883 views

How to reverse engineer URL routes from a bulk of HTTP requests/responses

I am building a web application crawler that crawls for HTTP requests (GET, PUT, POST, ...). It is designed for one specific purpose; bug bounty hunting. It enables pentesters to insert exploit ...
2 votes
2 answers
298 views

Trying to teach a high school student Dynamic Memory Allocation - what are the best ways to do so?

Copied from stack overflow due to feedback So I want to teach someone how to do dynamic memory allocation using the block padding model. What that means is every memory block is prefixed and ...
21 votes
5 answers
4k views

Algorithm for calculating a bullet path to a target with max. 2 ricochets

Sorry for the poor title but I didn't have a better way to phrase it... So there's this amazing game by Nintendo (yes!) on Wii called WiiPlay. There're 9 minigames in it, and my favorite one is ...
3 votes
1 answer
257 views

Practices for navigating uncertainty in software design

Background: So I'm trying to create my first game engine for learning purposes. After looking up a few articles I was able to design the beginning portions of my engine to at least get me going. My ...
2 votes
2 answers
4k views

Understanding of the Carry Flag Bit

Intel 8085: In my textbook it is said: "Carry Flag - this flag is the carry out from the MSB of the A-register. CY is set after an ADD instruction if carry out was generated from the A-register." I ...
3 votes
1 answer
4k views

Difficulties with Two's complement in Assembly

Everything discussed here will refer to Intel 8085 (8-bit architecture). When using two's complement number "conversion" : 1.) If we take SBI 0F (subtraction) for example; immediate value 0F(hex) or ...
0 votes
2 answers
3k views

Flowchart for solving programming problems [closed]

I noticed that every developer implements a somewhat different flowchart for solving programming problems. By flowchart I mean a defined system of techniques that the developer goes through in a ...
3 votes
1 answer
391 views

What is this Algorithm called? [Traveling Salesman Problem]

I've been thinking about the Traveling Salesman Problem. In examining it and grids of cities, I noticed that I could frequently pick out the shortest route just by staring at it. Granted, I couldn't ...
1 vote
2 answers
2k views

Having trouble with AP computer science sample test problem

I am currently taking AP Computer Science at my high school and while looking at some sample AP test problems I came across one that really confused me. Sample Problem The answer to the problem is ...
58 votes
12 answers
11k views

What programming language generates fewest hard-to-find bugs? [closed]

What language, in your opinion, allows the average programmer to output features with the least amount of hard-to-find bugs? This is of course, a very broad question, and I'm interested in very broad ...
0 votes
7 answers
578 views

How to avoid errors and not miss anything [duplicate]

I have a problem that is more serious than it might seem. I've been programming for about three years , and I have learned and improved a lot , I read the code easily to others, understand the ...
18 votes
3 answers
3k views

How to avoid jumping to a solution when under pressure? [closed]

When under a particularly strict programming deadline (like an hour), if I panic at all, my tendency is to jump into coding without a real plan and hope I figure it out as I go along. Given enough ...
4 votes
3 answers
196 views

How do you deal when an error occurs on 1 instance of your website/program/app?

I've had a couple of times in the time I've working, moments when I get an error ocurring in just 1 computer and it often takes me hours or days to figure out because it is (or at least seems) an ...
0 votes
2 answers
224 views

Recognize bug or inability to solve a problem by yourself

How to recognize when there is a bug in program or you have an inability to solve concrete problem? I noticed when I concentrate too much time on a problem and can't find a solution, I am starting to ...
15 votes
4 answers
2k views

What programming problems do Monads solve? [closed]

I've read a lot of posts that explain what monads are, how unit and bind work, some of them plunging straight into category theory so abstract (for me at least) that makes the eyes bleed, some ...
62 votes
15 answers
13k views

Dealing with frustration when things don't work [closed]

You ever try to implement something simple but for some strange reason it doesn't work. So you try a possible solution but then something else doesn't work. You keep trying different workarounds but ...
1 vote
2 answers
363 views

How do I have a group of numbers which total does not exceed a limit, and each number must be >= 0?

Suppose I have an array of n numbers. The rules for the array is as below: All the numbers must add up to 1000 If a number changes (positive or negative), all the other numbers in the array must be ...
43 votes
12 answers
5k views

Is thinking out loud during an interview really the best strategy? [closed]

In another question I asked recently about best practices for whiteboarding, there was general consensus that thinking out loud while coming up with the answer was the best strategy. Indeed, long ...
30 votes
13 answers
10k views

Is "White-Board-Coding" inappropriate during interviews? [closed]

This is a somewhat subjective quesiton but I'd love to hear feedback/opinions from either interviewers/interviewees on the topic. We split our technical interview into 4 parts. Write Code, Read & ...
1 vote
1 answer
418 views

Questions about the issue of getting stuck in a problem, and making snail's pace progress [closed]

Let me describe my background. I am currently a software developer co-op working at an architecture firm that has a large focus on research and development, mainly in mathematical modeling and ...
5 votes
1 answer
501 views

Does anybody recognize this scheduling problem? Is there an algorithm for it?

Consider the following problem: Description: There are n jobs J1...Jn with cycle times C1....Cn. Find a time quantum and a scheduling table considering that: any element of the table contains at ...
2 votes
3 answers
705 views

shadow simulation from buildings

Is it possible to calculate shadow areas of buildings or simulate shadows of buildings in a city, using the heights of these buildings and the sun angle and azimuth? The basic light tracing concept ...
-2 votes
1 answer
529 views

Pairing 40 people over 20 days such that no pair is the same twice or more [duplicate]

I'm trying to figure out what algorithm / method I can use to figure out how to pair people together such that the pairs aren't repeated i.e. if a unique individual is denoted by Px where x is their "...
1 vote
1 answer
773 views

Increment or double problem

I have a problem with an assignment. In this assignment I have to create a program which needs to calculate how many different possibilities are there to get from number a to b. To get from a to b you ...
0 votes
0 answers
597 views

scrabble solving with maximum score

I was asked a question You are given a list of characters, a score associated with each character and a dictionary of valid words ( say normal English dictionary ). you have to form a word out ...
0 votes
1 answer
174 views

Estimed number of tries

Problem: The Oscar Committee wants to decide which person should get the best actor award among the given N actors.For that they decided to use a random function random_bit() which returns either 0 ...
1 vote
1 answer
1k views

Turn over cards in minimum number of steps

Imagine you're given an array of cards. Some of them are facing down (0), while some of them are facing up (1). Is it possible for given fixed K to turn all the cards face-up by turning over any K ...
1 vote
0 answers
331 views

Karger's algorithm for bin-packing?

I first came across that algorithm as the "Random minimum cut" algorithm. And recently a colleague was trying to pack a big quantity of small textures into one image file. Then it clicked - why not ...
2 votes
1 answer
793 views

Genetic Algorithm's Tournament Selection limit to be selected

I started working again on a Genetic Algorithm and i'm trying a lot of operators and ways of selection. When I made the Tournament Selection , I noticed that it gets really easy to always get the top ...
12 votes
10 answers
817 views

Why does not thinking about a bug sometimes help you solve it? [closed]

Yesterday I spent a good part of the afternoon trying to fix a bug, which I thought to be trivial. I was going around in circles, not having a clue what was wrong. Rewriting large parts of the code. ...
-1 votes
2 answers
233 views

How do developers deal with "where to start" problem in a context of overwhelming difficulties caused by too much heterogeneous information? [closed]

A friend of mine, a beginner PHP programmer, needs to link the product his company develops with a third-party product (a set of web services). He received the "relevant" documentation (a few hundred ...
3 votes
2 answers
276 views

Ranking players depending on decision making during a game

How would I go about a ranking system for players that play a game? Basically, looking at video games, players throughout the game make critical decisions that ultimately impact the end game result. ...