I like to write the code in my own way inside [int main()] function in C++.
But hiring tests forced me to write code inside some function and well yeah, I screwed up.
So I have many doubts, please clear it up .
Their compiler show stuff like this:-
using namespace std;
int solution(vector <int > &v)
There is no int main() allowed here.
So what does it mean ? I don’t have to read the input ? I already know the input ?
If I want to write a dfs function, am I allowed to create a function above this function ?
If I want to declare a global array, am I allowed to write it above ?
How does their compiler read the array elements when I did not read it on my own ?
I know my doubts are very trivial, don’t judge me as I have started coding recently…