Anaplan interview question

Good: foo() bar() foo() + bar() foo(bat()) foo(1 + bat()) bat(foo()) foo() + bar() + bat() Bad: foo(bar()) foo(1 + bar()) foo(22 / bar()) foo(foo()) foo(bar() - 1) bar(bar() * 2) In Anaplan you can combine functions to build up complex formulas (a bit like you might in Excel). Some of these formulas can provide poor performance when one function calls another. Before we can resolve these performance issues, we first need to identify these formulas. In this test, foo() and bar() are functions that cause poor performance when they are nested inside each other. Write an expression which matches all formulas where the functions foo() or bar() call the functions foo() or bar(). I.e. match everything on the 'Bad' list (plus some others), and nothing on the 'Good' list.