- Upvotes Received
- 2
- Posts with Upvotes
- 2
- Upvoting Members
- 2
- Downvotes Received
- 0
- Posts with Downvotes
- 0
- Downvoting Members
- 0
Self-taught programmer.
- Interests
- Algorithmic Problem Solving, Problem Solving, Techs, Programming, Graphics and etc.
13 Posted Topics
Re: You can use modular arithmetic to make a variable to take values between 0 - (n-1) when it's incremented by 2, or you can take advantage of odd-even steps of the row number, just start the col iterator(j) from 0 when the row number is even and from 1 when … | |
Re: How are you going to read integer values for different letters ? | |
Re: The deck has 52 elements, so the elements will be indexed from 0-51, but in the loop it indexes 52. replacing aaa<=nSize with aaa<nSize will solve it. Also in the random index generating statement (line 28), (nHigh-nLow+1)is 53, so when using mod (%) with it has the possibility of generating … | |
Re: Hope this helps. #include "stdafx.h" int strlen(char str[]); int toint(char); char tochar(int); int main() { int i=0,len1,len2,max,min,j=0,k=0,l=0; int carry = 0 ; char num1[30],num2[30],ans[50]; gets_s(num1); gets_s(num2); len1=strlen(num1); len2=strlen(num2); if(len1>len2) { max=len1; min=len2; } else { max=len2; min=len1; } while(num1[i]!='\0') i++; j=max-1; while(j>=0) { num1[j]=num1[i-1]; i--; if(i<0) num1[j]=48; j--; } while(num2[k]!='\0') … | |
Re: You can modify and use DFS. For every node you can check if the depth of the two subtrees coming under it is equal or not. | |
Re: I have fixed your code. You don't have to return anything as phorce said already ,and why didn't you check for boundaries for the iterator 'j' like you did for 'i' in the partition function's for loops. And there is a trivial case where the partition function would go wrong, … | |
Re: This will do it. //Hanlding the operator part. else { if(start==NULL) push(*p); else { node *temp = start; while(temp) { q = temp->mdas.c_str(); temp = temp->nxt; if(prec(*q)>prec(*p)) postf.push_back(pop(*q)); else break; } push(*p); } | |
Re: What did you mean by making a character appear at its place ? | |
Re: An obvious way to get a touch on problem solving is to practice. I had that kind of problem too, the ways in which I solve problems were inconsistent. But when I solved more and more problems I developed a consistent way of solving problems. So now whenever I get … | |
Re: You can use it to print the elements of an array in ascending or descending order. Maintain a boolean list of size q to mark off the position of the largest (or smallest) element obtained from the inner loop, ignore it in the next turn if the position is marked. | |
Re: I think adding extra attributes to hold the parent's or ancestor's position in a cell will help. Every time before you add adjacent cells to the queue, set the values for the parent's co-ordinates of each valid adjacent node to that of the current cell's co-ordinates. If there's a solution, … | |
Re: Check the reading part again, the way you are reading the elements is wrong. | |
Re: In the loop, according the given instructions, you can check if the element of the array at the current index is odd or not. If it's odd multiply it by 3 else don't and add it to stepsTotal. And when adjusting to the closest multiple of 10 >= stepsTotal, simply … |
The End.