Finding the number of trailing zeros in N!
A simple example of finding trailing zeros in the factorial of N. public int TrailingZeroes(int n) { int result = 0; while(n!=0){ result += n/5; n = n/5; } return result; }
2 total
A simple example of finding trailing zeros in the factorial of N. public int TrailingZeroes(int n) { int result = 0; while(n!=0){ result += n/5; n = n/5; } return result; }
Given: An array of points on a plane: points[][] Xi and Yi. Need to find: The maximum number of points that belong to one line. Example: Original array: points= [[1,1],[3,2],[5,3],[4,1],[2,3],[1,4]] Result: 4 Example solution, not the best, but working: Explanation of the algorithm: Create a dictionary where the key is a pair [line equation + index of coordinates in the array].