2

Boolean String Value

 2 years ago
source link: https://www.techinterview.org/post/3233459765/boolean-string-value/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Tech Interview

A site for technical interview questions, brain teasers, puzzles, quizzles (whatever the heck those are) and other things that make you think!

    • 8 Sep 2017

      Boolean String Value

      Posted at 3:55 am by Admin, on September 8, 2017

      Given a string consisting of only 0, 1, A, B, C where
      A = AND
      B = OR
      C = XOR
      Calculate the value of the string assuming no order of precedence and evaluation is done from left to right.

      Examples:
      Input :
      1A0B1

      Output : 1
      1 AND 0 OR 1 = 1

      Input :
      2
      1C1B1B0A0
      1A0B1

      Output :
      0
      1

Proudly powered by WordPress.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK