I recently did 2 rounds of all day interviews at a big tech company where they ask you to solve these kinds of problems. I can see the value of some programming tests to make sure people can actually code, but I saw some major flaws in their methodology. One major problem is conveying what it is you really want the applicant to do. I had several questions where I thought they wanted the algorithm to solve the problem, when really all they wanted was a library call. Another issue is when there's not one clear "best" solution. I had one interviewer tell me to code a problem optimizing for time and space complexity. He interrupted me 3 times because he didn't understand my algorithm, and when he announced the "correct" algorithm, it was actually worse time complexity and only slightly better space complexity. The biggest problem of all, though, is the questions where they want you to implement some sort of bit manipulation algorithm when doing so is both unreadable and a non-optimal approach to solving the problem.
In the end, I didn't get the job. I was out 4 days of vacation time and 2 weekends that I could have spent with my family. They were out about $4000 from the cost of flying me out and back twice, putting me up in a hotel, etc. In the end both of us would have been much better off if they had just called some references instead.