Bit Manipulation - Subsets Using Bitmask
Consider the following buggy code for generating subsets. Which line contains the subtle bug that causes all subsets in
res to be the same list instance?res to be the same list instance?path directly adds a reference, not a copy, so all entries point to the same list object.pathpath[:] or list(path) creates a snapshot copy, preserving each subset uniquely.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions