- Want to Start 2D 3D Animation Studio
- Hanna Barbara animation frame rate
- Does openssl refuse self signed certificates without basic constraints?
- Website asks for my identification card - Is it safe?
- Secure Server start up
- What are some instant red flags when scanning an network with nmap
- Multiple devices authorization with refresh tokens
- Do the concentration of electrons in a circuit affect the magnetic field?
- Is there work done when you push a book on a table? what about when you lift the book up?
- Eigen Function of Lz
- Derive the motion of three masses connected with a spring when an external force is applied to one of them
- Dependence of extention on length
- equation of state cosmology
- Electricity and magnetism
- Binning or just skipping values in a simulation to avoid autocorrelation
- Is it possible to transfer kinetic energy from rigid body 1 to body 2 and conserve total energy?
- Phase transition between two CFTs
- Why so many people use “house rules” in EDH/Commander?
- Using whatsapp without my SIM
- How to turn off auto suggestion popups in Google Keep?
Find the minimum value in a circular list of integers
I was looking up some coding challenges and this looked like a fun one to solve. I tested it with the following values and it seems to work for those at least:
[ 5, 7, 8, 9, 11, 2, 3 ]
[ 5, 7, 1, 4]
[ 5, 7, 8, 1, 5]
[ 5, 1, 2, 3, 5]
[ 5, 5, 5]
[ 1 ]
[ 1, 2 ]
[ 2, 1 ]
My solution was to implement a binary search to try and find the smallest value, and if both ends of the sub-list have the same value then I will increment from the lowest value to try and work out if the lowest value lies in the first or second half of the sublist. I am not 100% confident that this part of the solution is bug free, so would appreciate any feedback on that.
I am mostly looking for feedback on my logic, as the coding standard doesn't matter to me too much in this case.
public static int findMinimum(List
return findMinRecursive(input, 0, input.size() - 1);
public static int findMinRecursive(List