15,789,360 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Python questions
View PHP questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by _-_-_-me (Top 93 by date)
_-_-_-me
4-Aug-21 6:56am
View
Okay , Thank you !
please , could you explain the meaning of mask ?
Here what is mask ?
Is it the one which we are shifting ?
Thank you !
_-_-_-me
3-Aug-21 9:30am
View
Thank you very much :-)
_-_-_-me
3-Aug-21 2:22am
View
Deleted
Thank you very much !
set a bit - generate a mask by shifting 1 to the desired position
- Here- what is desired position?
I understood it like this:
In a case to increase bit size.
Suppose when you want to store 4 bit in an 8 bit .
Is my understanding correct?
If my understanding is correct:
Why one have to increase the size , it would lead to more memmory wastage .
Thank you !
_-_-_-me
3-Aug-21 2:22am
View
Thank you very much !
set a bit - generate a mask by shifting 1 to the desired position
- Here- what is desired position?
I understood it like this:
In a case to increase bit size.
Suppose when you want to store 4 bit in an 8 bit .
Is my understanding correct?
If my understanding is correct:
Why one have to increase the size , it would lead to more memmory wastage .
Thank you !
_-_-_-me
3-Aug-21 2:07am
View
Okay , thank you !
The conclusion is : Its pretty much used everywhere. So, one have to understand how the bit wise operators work :-)
_-_-_-me
3-Aug-21 2:04am
View
Okay , thank you!
_-_-_-me
3-Aug-21 2:01am
View
But I don't know who the author is
I saw this code in submitted answers section
Thank you !
_-_-_-me
31-Jul-21 2:05am
View
But , why b is included ?
_-_-_-me
28-Jul-21 11:02am
View
Whenever in the question if they asked to find the solution with less time complexity , I am always using hashmap with out knowing myself.
Because , I am only getting the hash map related idea.
If I think more and more and more... other than hash tag, days are being completed , I am taking 2 days for solving a question , then at last I am always being ended with hash tag.
How could we get the idea on algorithms with less time complexity ?
Thank you !
_-_-_-me
28-Jul-21 10:54am
View
:-)
I did not use it anywhere . I just got that doubt that what happens in this case.
_-_-_-me
27-Jul-21 7:14am
View
But , it takes O(n square ) complexity. They asked to find with less than O(n square) complexity .
_-_-_-me
26-Jul-21 3:07am
View
Does the solution also depends up on the language ?
Does the solution becomes easy when we know different language such as java, c++ ?
or
Does it not depend?
Thank you!
_-_-_-me
26-Jul-21 3:04am
View
When I solve this by hand,
I am doing it like this,
For every element of the array, I am calculating target-element, and then I am searching whether this value exists or not in the array .
But, this process is taking O(n square) time complexity .
_-_-_-me
26-Jul-21 3:00am
View
Okay ,
when I solve this by hand ,
I am solving with the idea same as using the code which takes O(n square) complexity .
In that case , How could we know ?
How can we get the idea of algorithm as simple as possible ?
How could we know that algorithm is:
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
I also got this idea:
First sorting with time complexity less than O(n square) , and then take two variables , which should be acted as index .
These two indexes , one should start form beginning and other from last of the array .
If the sum is greater than the target , last variable should be decremented.
If the sum is less than target, then the first variable should be incremented...
Thank you !
_-_-_-me
26-Jul-21 0:31am
View
Okay .
_-_-_-me
26-Jul-21 0:02am
View
Sorry, I forgot to write the complete question .
In the question , they also given that to write the code with time complexity less than O(n square) .
Thank you!
_-_-_-me
19-Jul-21 12:12pm
View
Okay
Thank you!
:-)
_-_-_-me
19-Jul-21 12:09pm
View
Okay
Thank you !
:-)
I typed help and enter
It showed all the commands...
It was like this:
CD : Displays the name of or changes the current directory.
But,
Why should we use CD\ ?
Why we should not use only CD ?
Because In the commands it only showed CD.....
_-_-_-me
19-Jul-21 12:03pm
View
OKAY
:-)
_-_-_-me
18-Jul-21 0:39am
View
I understood how to debug in an efficient way.
Thank you!
_-_-_-me
17-Jul-21 23:30pm
View
Thank you !
These two sentences helped a lot :
1) try to solve this input by hand, do you need to use hash to get the solution?
2) How you solved the problem by hand should be your algorithm.
_-_-_-me
17-Jul-21 23:28pm
View
Okay, thank you !
I will first sort g and find out ...
_-_-_-me
17-Jul-21 4:07am
View
Okay , thank you !!!
But the input is very long...
Its very hard...
_-_-_-me
10-Jul-21 8:53am
View
I mistakenly used strcpy() instead of strcmp() .
I used strcmp() now but even then I am not getting correct output.
_-_-_-me
10-Jul-21 7:41am
View
I checked it with the value of count .
Is it incorrect?
_-_-_-me
29-Jun-21 4:21am
View
Okay , thank you !
_-_-_-me
29-Jun-21 2:47am
View
If I am going in a wrong way , please give a suggestion to me to go in a good way and efficient way.....
I did not find good courses of data and algo through c. But I found good courses on data structures and algorithms through java,c++,python ..
I dont know any of these languages
I am learning course on ds and algo through c from udemy .
I am solving questions from leetcode.
When solving question , if I did not get the approach of doing that , I am referring geeks for geeks.. and referring that concept in deep ...
Is this the bad approach ?
What should I do?
I came to know that it is better to learn ds and algorithms through c++,java,python etc...
I am in first year.
In first year of my college, the syllabus is c language and data structures through c (basic) .
So, I am learning ds and algo through c.
After one month when I go to second year , the syllabus is java and data structures and algorithms through java (advanced).
I did not read any book for c language and data structures through c ..
If I start now, I would not be able to complete in one month.
So , shall I take a good course or start reading a book of ds and algo through java when it get started?
If I am going in wrong way , please say the correct way or correct approach.
Should I take a course or read a book for ds and algo through java
There were some good courses ds and algo through java (6 months) which starts after two months and so many students like 50,000 enrolled until now.
It gives worksheets and gives us our ranking among the students enrolled ...
Shall I take this course or read a book? or both ?
Thank you !!!!
_-_-_-me
29-Jun-21 1:28am
View
okay, thank you very much!
_-_-_-me
28-Jun-21 22:34pm
View
okay.
_-_-_-me
27-Jun-21 9:23am
View
oh, okay .
Thank you very much !
You explained it very clear.
I am so grateful for all the help!
_-_-_-me
27-Jun-21 9:19am
View
oh , okay .
Thank you very much . You explained it very clearly . I am grateful to you for the help!
_-_-_-me
26-Jun-21 12:33pm
View
Thank you very much :-)
_-_-_-me
25-Jun-21 5:30am
View
:-)
_-_-_-me
24-Jun-21 11:31am
View
Thank you!
_-_-_-me
24-Jun-21 11:30am
View
Okay, thank you!
_-_-_-me
24-Jun-21 8:38am
View
Okay :(
_-_-_-me
24-Jun-21 8:36am
View
*returnColumnSizes = (int**)malloc(sizeof(int*) * numRows);
*(*returnColumnSizes+i)=i+1;// This statement is in loop
and
*returnColumnSizes = (int**)malloc(sizeof(int*) * numRows);
*(returnColumnSizes)[i]=i+1;//This statement is also in the loop same as first one
What is the difference between these two?
Thank you !
_-_-_-me
24-Jun-21 0:07am
View
*returnColumnSizes = (int**)malloc(sizeof(int*) * numRows);
*(*returnColumnSizes+i)=i+1;// This statement is in loop
and
*returnColumnSizes = (int**)malloc(sizeof(int*) * numRows);
*(returnColumnSizes)[i]=i+1;//This statement is also in the loop same as first one
What is the difference between these two?
Thank you !
If I use first one instead of second one , I am not getting error.
_-_-_-me
24-Jun-21 0:04am
View
*returnColumnSizes = (int**)malloc(sizeof(int*) * numRows);
*(*returnColumnSizes+i)=i+1;// This statement is in loop
and
*returnColumnSizes = (int**)malloc(sizeof(int*) * numRows);
*(returnColumnSizes)[i]=i+1;//This statement is also in the loop same as first one
What is the difference between these two?
Thank you !
_-_-_-me
23-Jun-21 10:19am
View
Thank you!
Here it is declared like this:
The declaration is this,
int **returnColumnSizes;
_-_-_-me
23-Jun-21 10:16am
View
Here returnColumnSizes is a double pointer .
It is like this:
int ** returnColumnSizes;
_-_-_-me
23-Jun-21 8:18am
View
Should we use calloc() or malloc() function here?
As we are returning the double pointer p, we are passing the double pointer p to the free() function in main() function.
Can we pass double pointer to the free function?
_-_-_-me
23-Jun-21 8:10am
View
I did debug the program, but I was unable to find any mistake.
_-_-_-me
23-Jun-21 2:35am
View
Can I delete this?
_-_-_-me
23-Jun-21 2:28am
View
Sorry ,
AS I saw the question , I became so much excited to post the answer because I never posted an answer to a question before.
This is the first time I am seeing a question, that I am familiar with.
I did not think deep that it would effect someone.
I will not repeat this again.
Thank you !
_-_-_-me
20-Jun-21 3:40am
View
Thank you very much !
According to the hint:
One array is bigger enough to store everything in both.
and
What would happen if you went from the end of each array instead of the beginning?
I understood it why we should only go from end--
We should only go from end to front but not front to end otherwise the nums1 array elements would be disturbed .
and we should start storing elements in decreasing order from end.
I got it.
Thank you!
_-_-_-me
20-Jun-21 3:24am
View
I think it would go to else part.
_-_-_-me
18-Jun-21 22:03pm
View
How could we know which is correct variable?
If I take an example , in that case if l would be true
But in every case ,
How could we know which one would be true?
_-_-_-me
18-Jun-21 21:46pm
View
Thank you !
But why we should only return h, why we should not return l ?
_-_-_-me
18-Jun-21 10:51am
View
Oh, Thank you :)
I should write l<=h in while loop ,right?
_-_-_-me
18-Jun-21 9:27am
View
29 degree C at 9 Pm for us.
_-_-_-me
17-Jun-21 8:14am
View
okay , Thank you !
_-_-_-me
17-Jun-21 3:32am
View
I got it now!
Here In the question it was not specified that nums[] array would be only positive elements.
There are chances that the elements of nums[] array would be negative.
In that case the hash[] would access negative index which is not valid.
Thank you !
_-_-_-me
15-Jun-21 8:08am
View
We have to code the function that was called in main function.
The variables nums, numsSize are already automatically given .
and the return type and function name are already given when the question was opened .
_-_-_-me
15-Jun-21 8:05am
View
No, I have not declared the array and the call to remove duplicates.
I have not written main function .
In that answer or compiler , no need to write main function.
We have to write only the function that was called in the main
function.
_-_-_-me
15-Jun-21 7:55am
View
Thank you very much !
Thanks for trying that in the leet code website.
No,Exactly I copied and pasted it here. There is no other information that
I have note shown you .
I completely pasted my answer.
It is 26th question.
In the question part this is remaining I have not shown :
Custom Judge:
The judge will test your solution with the following code:
int[] nums = [...]; // Input array
int[] expectedNums = [...]; // The expected answer with correct length
int k = removeDuplicates(nums); // Calls your implementation
assert k == expectedNums.length;
for (int i = 0; i < k; i++) {
assert nums[i] == expectedNums[i];
}
If all assertions pass, then your solution will be accepted.
_-_-_-me
15-Jun-21 6:57am
View
Thank you !
I tried that in online compiler , it worked fine.
But when I tried in the compiler that was provided in the question of leet code ,
I am getting this error.
_-_-_-me
15-Jun-21 1:29am
View
Thank you very much!
You told to learn the debugging a while ago.
I started using debugger when you told the first time to learn the skill
debugging.
Because of that I was able to find the errors in code .
Thanks for saying that!
In this,
When I debugged the code in the online compiler(onlinegdb.com),
Even though the k value of k is increased to numsSize , but it is not accessing
the array memmory as while loop terminates.
and I am not getting error in online compiler.
When I the submit the answer to the question through the compiler in leetcode , I am getting this error.
In that compiler , I was unable to debug because debug option is not accessible to
me.
_-_-_-me
12-Jun-21 7:16am
View
Hehehe. I too don't know. I thought the PC is in problem as there is no line 28.
Thank you very much!
_-_-_-me
12-Jun-21 7:14am
View
Okay , thank you very much !
With out writing the main () function and writing in binary search procedure, I am getting no error.
I think compiler writes its main() function.
Is it possible?
_-_-_-me
12-Jun-21 7:11am
View
Thank you very much.
Yes , I will follow Binary search algorithm.
With out writing the main () function and writing in binary search procedure, I am
getting no error.
_-_-_-me
12-Jun-21 7:10am
View
Thank you very much
With out writing the main () function and writing in binary search procedure, I am getting no error.
Does the compiler itself writes the main function?
_-_-_-me
12-Jun-21 4:00am
View
I switched off the Pc, switched on again and refreshed the browser, but it is showing the same error.
There is no line 28.
_-_-_-me
12-Jun-21 3:57am
View
Yes, There is no line 28.
But, it is showing the same error.
Again I compiled it and checked the output.
It is showing the same error.
_-_-_-me
12-Jun-21 3:43am
View
But it is showing error really.
_-_-_-me
4-Jun-21 7:13am
View
okay, thank you very much . I got it now.
_-_-_-me
10-May-21 8:00am
View
Sorry , I asked this type of mistake already. You already explained very clearly.
Thank you very much for your valuable time.
_-_-_-me
10-May-21 7:59am
View
Sorry , I asked this type of mistake already. You already explained very clearly.
Thank you very much for your valuable time.
_-_-_-me
9-May-21 14:50pm
View
Thank you very much for your help!!!
_-_-_-me
9-May-21 13:36pm
View
Thank you. Does the base of the logorithm contain 2 ?
_-_-_-me
9-May-21 4:21am
View
Okay , I will try to fix the syntax errors on my own. Thank you for offering your valuable advice.
_-_-_-me
9-May-21 4:20am
View
Deleted
Okay, I will try to fix the syntax errors on my own. Thank you for offering your valuable advice.
_-_-_-me
8-May-21 2:47am
View
Okay, many thanks!
_-_-_-me
7-May-21 1:29am
View
Oh,Thank you . I forgot to include stdlib, but even after including , i am getting error .i.e (undefined referrence to the function).
_-_-_-me
6-May-21 8:24am
View
okay, thank you very much!
_-_-_-me
6-May-21 8:23am
View
Oh,Thank you very much!
Why we should include if statement there? and why we should pass p as argument there in p? Is it because to make sure that p points to some memmory location?
_-_-_-me
6-May-21 8:19am
View
You explained it very clearly. Thank you very much!
_-_-_-me
1-May-21 11:38am
View
Why it is waiting for other input value?
Thank you !
_-_-_-me
1-May-21 11:29am
View
why it is hanging in scanf()?
But In the case of not using new line character in first scanf() function , and using new line character in scanf() of for loop . It is not hanging up
why is that so?
Thank you !
_-_-_-me
30-Apr-21 10:18am
View
Do we have to only declare the array after the scanf() function in this case?
_-_-_-me
30-Apr-21 10:17am
View
When I debug,I got bus error.
but when I declare the array a after scanf() function , I got no error .
_-_-_-me
30-Apr-21 8:52am
View
Thank you for the information.
I will learn how to debug the program
_-_-_-me
28-Apr-21 10:15am
View
Thank you very much!
I downloaded the book "programming in c(3rd Edition) by stephen kochan ".
Is this the good one?
I will start learning it now .
Thank you very much!
_-_-_-me
28-Apr-21 2:31am
View
I am new to programming. I don't know anything. As I was studying the lecture class, it was given that when we initialize the number of elements less than the size of array, the remaining elements will be initialized to zero. So , I got the doubt that what would happen when no elements are given to initialize.
Thank you!!!
_-_-_-me
28-Apr-21 2:28am
View
Deleted
I am new to programming. I don't know anything. As I was studying the lecture class, it was given that when we initialize the number of elements less than the size of array, the remaining elements will be initialized to zero. So , I got the doubt that what would happen when no elements are given to initialize.
Thank you!!!
_-_-_-me
26-Apr-21 2:18am
View
I am getting question mark with in the rhombus diagram. Why is that so ?
Thank you !!!
_-_-_-me
26-Apr-21 2:17am
View
I am getting question mark as output. Why is that so?
Thank you.
_-_-_-me
26-Apr-21 2:11am
View
It is because I did not pass address of the variable (pointer) to the scanf() function , I passed the variable itself.
I got it now.
Thank you.
In hint,
what happens if you pass an uninitialized value to a function expecting a pointer?
My Imagination:
I passed the variable x(auto variable) to the scanf() function. As this is auto variable, it contains some garbage value . This garbage value points to something which is not created at all.It points to something in which there is no memmory for it. So, we get error as segmentation fault(core dumped). This is the error we get when we tried to access the memmory that you do not have access to .
Is this correct?
Thank you!!!
_-_-_-me
25-Apr-21 1:26am
View
Thank you.
_-_-_-me
25-Apr-21 1:24am
View
These are not homework questions.
_-_-_-me
25-Apr-21 1:11am
View
Okay,next time when I ask questions , I will clearly mention the error. Thank you.
_-_-_-me
24-Apr-21 7:33am
View
okay , thank you very much.
_-_-_-me
24-Apr-21 4:01am
View
While using strcat() function , does the concatenation of the strings take place at run time? Because when strcat() function is used , error is obtained.
Show More