# Tag Info

Accepted

### Counting permutations without repetitions for a number or a string

One of the best ways to make a program faster is not to compute things that you don't have to. In this question you are asked to compute the number of permutations. But your implementation goes and ...
• 49.2k
Accepted

### Analyzing Minesweeper Probabilities

GroupValues GroupValues doesn't seem to serve much of a purpose beyond what you get from Map; it adds no functionality beyond ...
• 5,174

### Solution for kth row of Pascal's triangle for a job interview

For one thing, the inconsistency with whitespace use and curly brace placing may demonstrate a lack of attention to detail. Before you attack the actual problem, make sure your code is written ...
• 34.7k
Accepted

### Solution for kth row of Pascal's triangle for a job interview

There are at least two optimizations you could make. First of all, you are performing r multiplications and r divisions for ...
• 1,188

### Solution for kth row of Pascal's triangle for a job interview

Types are very important in C++. You are being sloppy with your types. long long sol; // big int object. While you are putting it into an object that only ...
• 91.7k
Accepted

### Count number of ways to paint a fence with N posts using K colors

1. Code review The question says, "Write an algorithm that counts the number of ways" but the program does not only do this: it also builds a list of the combinations. This means that the program is ...
• 49.2k
Accepted

### Brute Force Algorithm in C

I'm going to skip reviewing the OP's code, which has already been reviewed quite nicely by others. Instead I'm just going to show a much faster version and explain it. What is the algorithm? ...
• 28.4k

### Solution for kth row of Pascal's triangle for a job interview

I am kind of curious why you separated the Int variable out of the for loop? ...
• 28.5k

• 49.2k
Accepted

### Determine if one string is a permutation of the another

Comparing two maps is linear, so that's not a big problem. I don't think you've made particularly good use of maps though. As I see it, you have two choices. You could use an ...
• 33.2k

### Analyzing Minesweeper Probabilities

One of the first rule I try to always follow is to be consistent. You're not always following the same pattern in your code for brackets. ...
• 6,661
Accepted

### Generate all possible combinations of letters in a word

I'm going to throw my hat in the ring with the iterative version of Heap's method of generating permutations. It took me a while to get right, as my reference source has a typo in the algorithm -_-. <...
• 16.1k
Accepted

### A beautiful and easy way of permutation with recursion

The simpler code would look something like this: ...
• 33.2k

### Get distinct combinations of numbers

Let's talk algorithms, and complexity..... and what the actual problem is that you are trying to solve. Background Three concepts: distinct, permutation, and combination Distinct Distinct values ...
• 96.7k