Gaurav
#include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } const int N = 1e6+2; int idx[N]; for(int i=0;i<N;i++){ idx[i] = -1; } int minidx = INT_MAX; for(int i=0;i<n;i++){ if(idx[a[i]] != -1){ minidx = min(minidx, idx[a[i]]); }else{ idx[a[i]] = i; } } if(minidx == INT_MAX){ cout<<"-1"<<endl; }else{ cout<<minidx+1<<endl; } return 0; }
Anonymous
Write a program in C that allows the user to enter two integers. When the first integer is bigger than the second, the program should call a function to subtract these integers. When the second integer is bigger than the first, the program should call a function to multiply them. When first integer is equal to the second integer, the program should call a function to add these integers. When one of the integers is a zero, the program should insert these two integers into an array of size 2. Then the program should call a function and pass these two elements of an array as actual parameters to a function that will add these two elements. Otherwise, the program should output: invalid input.
Anonymous
Gaurav
What does it say?
Thanks but problem solved☺️
Anonymous
no
Help me
Anonymous
no
Why ?
Apk
Why ?
Don't tell others to do your homework.
Apk
If you wrote some code which is not working show that
...
Based on the homework you get, I assume you learned all the needed things to program something like that?
Anonymous
Why ?
no mentor will teach you 2+2 = 4 and then ask you to derive e = mc^2 as homework, so pretty sure, they had already taught you the necessary stuff needed to solve that homework
Anonymous
Why ?
Read the rules
Rukiye
Depends what you want to extract, maybe try regex, or split it based on the comma
First row has 5 value 5,10,20,15,20 i have to store them like integer. And other rows have service no, service, number of services, service price. Can you help me?
Andrew
First row has 5 value 5,10,20,15,20 i have to store them like integer. And other rows have service no, service, number of services, service price. Can you help me?
read row by row, find a function on the internet that split a row into an array based on a delimiter then convert each piece to integer.
Anonymous
What is the best way to learn C ? Reading or Videos ... Any resources ?
Chandresh
Anyone please help to find next permutations with c language
Anonymous
Anyone please help to find next permutations with c language
i don't think there are any permutations of C language. you can definitely write one with one-to-one correspondence between its keywords and C's keywords. then write a script to find and replace the keywords and call it a compiler.
Anonymous
🏃💨
Anonymous
Janko Ⓥ
Lol
I mean, you can't be in college without knowing something like that
Anonymous
Bro i have a array of string.and i want to find next permutation of that string array
nobody is going to help you with stupid shit that you can google. post your code and people might help with what is wrong in it.
Anonymous
I mean, you can't be in college without knowing something like that
I am I don't know how to write this algorithm without looking up
Janko Ⓥ
Am I missing something? Looks like a couple of conditions
Anonymous
👍
goo.gl/search?how+to+permutation+c
Chandresh
goo.gl/search?how+to+permutation+c
this is algo for finding possible permutation
Chandresh
not for next permutaiona
Chandresh
as in c++ there is std::next_permutation
Chandresh
i want that in c
Anonymous
not for next permutaiona
goo.gl/search?next+permutation
Anonymous
Am I missing something? Looks like a couple of conditions
https://en.cppreference.com/w/cpp/algorithm/next_permutation I looked up possible impl Doesn't seem so obvious to me
Anonymous
the first two results
Anonymous
goo.gl/search?next+permutation
the leetcode one even has complexity analysis done for you
...
Write a program in C that allows the user to enter two integers. When the first integer is bigger than the second, the program should call a function to subtract these integers. When the second integer is bigger than the first, the program should call a function to multiply them. When first integer is equal to the second integer, the program should call a function to add these integers. When one of the integers is a zero, the program should insert these two integers into an array of size 2. Then the program should call a function and pass these two elements of an array as actual parameters to a function that will add these two elements. Otherwise, the program should output: invalid input.
...
it was about this
...
thanks for the report, im not asking this though
Anonymous
oh
Janko Ⓥ
He was quoting to remind us which program I was talking about
Anonymous
sorry
Ahmed
Guys how many years does it take to master C++?
Anonymous
it was about this
Instead of forwarding you can use links for messages
Ahmed
Okay
...
Instead of forwarding you can use links for messages
ohh didn't know, i didnt wanna reply to ping them
Anonymous
He was quoting to remind us which program I was talking about
Oh I'm sorry Apparently I'm blind😂
Anonymous
https://www.reddit.com/r/ProgrammerHumor/comments/a0825b/
Anonymous
Anonymous
This is c
A, the link is just telling lies
Anonymous
A, the link is just telling lies
a0825b/learn_c_in_21_days_most_practical_way
Anonymous
https://oleksandrkvl.github.io/2021/04/02/cpp-20-overview.html
Anonymous
Hi
klimi
Hi
nohello.com
Anonymous
/get cpp book
Anonymous
/get cppbookguide
Abdul
/get cbook
Rukiye
I wanna write eeprom string values like; 10,20,30 30,2,8 So i wrote; WriteStringtoEEPROM(0, "10,20,30"); WriteStringToEEPROM(?,"30,2,8"); What do I have to write inside of "?"?
Rukiye
Mainly what is the address of second string value?
Rukiye
I use eeprom.h
Hmaada
hello i have a question about threads please can anyone help me ?
Anonymous
Dont ask to ask, just ask 😅