Bifalgorithm post

Alright, let's take a look at this hard multiple choice question. Given the following method declaration, this method will return true if and only if. So here's the function. It takes in an input s where we check if the length is greater than equal to. So let's write that down. Length greater than equal to two. And then we also check if the character at position zero and the character at position one are the same. Or if that's not true, we'll call check, which is this function. And we do s.substring1, which means we'll remove the first letter in the string and we'll call the function check recursively. So basically this function will only return true if there are two characters side by side in a string that are the same characters. So the answer should be c. The string s contains two or more of the same characters that are next to each other. So let's submit and we got it right.

Alright, let's take a look at this hard multiple choice question. Given the following method declaration, this method will return true if and only if. So here'…

Ideas in this flowchart

  • Multiple Choice Question Analysis
  • Method Description
  • Input s
  • Length Check
  • Character Comparison
  • Recursive Check
  • Correct Answer
  • Condition for True
  • Two Adjacent Characters Same
  • Submit Answer
  • Answer C: Two Adjacent Same Characters
Feed/

Alright, let's take a look at this hard multiple choice question. Given the following method declaration, this method will return true if and only if. So here's the function. It takes in an input s where we check if the length is greater than equal to. So let's write that down. Length greater than equal to two. And then we also check if the character at position zero and the character at position one are the same. Or if that's not true, we'll call check, which is this function. And we do s.substring1, which means we'll remove the first letter in the string and we'll call the function check recursively. So basically this function will only return true if there are two characters side by side in a string that are the same characters. So the answer should be c. The string s contains two or more of the same characters that are next to each other. So let's submit and we got it right.

"let's take a look at this hard multiple choice question."

👍
0
0 comments0 shares

Sign in to view and post comments.