Logical Programming Interview Question