The shortlisting was done through our university based on our resume and academic performance. I was shortlisted and had two interviews of 45 minutes, each with a break of fifteen minutes in between. Both of them were technical rounds involving hands-on coding in a shared google doc while I was on a video call through Hangouts with the interviewer from Google.
Question: A boolean expression is given in the form of a string. It contains one variable x; logical operators – ‘and’, ‘or’ and relational operators – ‘>’, ‘<‘ (there is no >= or <=). Find if the expression always evaluates to False. If yes, output False, otherwise if there exists at least one x such that the given expression can be true, output true.
1. “x<0 and x>5”
Output – False
Explanation – This can never be true as there is no ‘x’ such as x<0 and x>5. So, the given boolean expression always evaluates to false.
2. “x>0 or x<-1”
Output – True
Explanation – We have at least one ‘x’ for which given boolean expression evaluates to true. For example, put x=2 in the given expression, and it evaluates to true.
Hint: Whenever there is only ‘or’ in the boolean expression, the result is always true. (Eg: x>0 or x<0 – There exists some x such that this is true and whatever be the latter part of the expression, it evaluates to true as only ‘or’ is present. If there is no ‘or’ present (only ‘and’ is there), then we check for the expressions – if you find at least two contradicting expressions as in example 1 (that is their solution sets are disjoint), then the output is False (as we have only ‘and’ logical operation which evaluates to False unless all the expressions are True), otherwise it is True.
I have no idea how to approach the problem when both ‘and, ‘ ‘or’ are present in the expression, and I could not find such a problem anywhere on the internet.
I request someone who read this article to contribute the code to this problem kindly. (preferably in C++)
Question: Given a string, find the minimum number of cuts to split the string so that all the resulting substrings are palindromes.
Explanation: Minimum number of cuts to partition “google” into palindromes = 2 that is –
goog|l|e – where ‘|’ refers to a cut, the three resulting palindromes are “goog”, “l”, “e”. Therefore, the minimum number of cuts required = 2.
Hint: Refer to this article.
- Google Interview Experience | Set 7 (For Software Engineering Intern)
- Google Interview Experience for Software Engineering Intern
- Google Summer Trainee Engineering Program(STEP) Interview Experience
- Amazon Interview Experience (For SDE Intern)
- ST Microelectronics Interview Experience (Intern)
- Innovaccer Interview Experience | SDE Intern
- Amazon Interview Experience | Set 318 (For SDE Intern)
- Amazon Interview Experience | SDE Intern
- Amazon interview Experience | Set 132 (For SDE Intern)
- Dailyhunt Intern Interview Experience
- Microsoft Interview Experience | Set 51 (For SDE Intern)
- Amazon Interview Experience | SDE-Intern
- Adobe Summer Intern Interview Experience
- Amazon Interview Experience | ( 6 Months Intern for SDE-1 )
- Arcesium Interview Experience 2018 (Intern)
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.