Tag Archives: Math

  1. Pow(x, n)

    Leave a comment

    September 24, 2017 by oneOokay

    Implement pow(x, n). 不是很明白pow(x, n)到底在考什么. 首先pow(x, n)表示x的n次幂. power就是幂. 考点在于: 速度要快,不能就直接for loop单个数字相乘. power也是乘法,要用乘法的特性来提高算法效率.所以直接乘就会TLE n可以为正数也可以为负数.注意负数:Integer.MIN_VAUE:是 [ – (2的31次方)]. Integer.MAX_VALUE是[2的31次方 – 1].所以Integer.MIN_VALUE的绝对值是会大于Integer.MAX_VALUE的绝对值的. 这里某些算法会产生over flow. …
    Continue reading

  2. 三个点的位置.Graham scan.Convex Hull

    Leave a comment

    June 18, 2017 by oneOokay

    解决的是几何问题… 两条直线是否相交 二维数组标示x,y的点的集合, Find simple closed path. 就是点集外檐的一个轮廓.(connect the dots without crossing) 同样点的集合,求形成一个凸包的边缘点的集合. Orientation of 3 ordered points http://www.geeksforgeeks.org/orientation-3-ordered-points/ 给3个点,判断这三个点的相对位置. …
    Continue reading

  3. Sparse Matrix Multiplication

    Leave a comment

    March 13, 2017 by oneOokay

    Given two sparse matrices A and B, return the result of AB. You may assume that A‘s column number is …
    Continue reading

  4. Roman to Integer/Integer to Roman

    Leave a comment

    February 13, 2017 by oneOokay

    roman numerals chart http://literacy.kent.edu/Minigrants/Cinci/romanchart.htm 罗马字表: I = 1; V = 5; X = 10; L = 50; C = 100; …
    Continue reading

  5. Excel Sheet Column Title/Number

    Leave a comment

    February 13, 2017 by oneOokay

    啊 我发现我竟然不太会进制转化… Excel Sheet Column Title Given a positive integer, return its corresponding column title as appear in an Excel …
    Continue reading