ÉèΪÊ×Ò³ ¼ÓÈëÊÕ²Ø

TOP

C++±à³Ì£¬Êý¾Ý½á¹¹£¬Ëã·¨ÀàÃæÊÔÌ⼯(8)(Èý)
2014-11-24 01:26:00 ¡¾´ó ÖРС¡¿ ä¯ÀÀ:296´Î
Tags£º±à³Ì Êý¾Ý½á¹¹ Ëã·¨ ÊÔÌ⼯
»ØËÝ£¬ÕÒµ½×µÄÄÜÕýºÃÆ´½ÓÔÚÒ»ÆðµÄ×µÄ·¶Î§



247. ÓÐ10¸öunsorted array, ·Ö¸ø10Ì«²»Í¬µÄ»úÆ÷´¦Àí£¬Õâ10̨»úÆ÷Ö®¼ä²»ÄÜͨÐÅ£¬µ«¿ÉÒÔºÍ×Ü»úͨÐÅ£¬ÈçºÎÇó×ܵÄmedian. ÈçºÎ¼õÉÙÊý¾ÝÁ¿µÄ´«Êä¡£


TO LEARN, Éè¼ÆÌâ



248. You have an array like ar[]= {1,3,2,4,5,4,2}. You need to create another array ar_low[] such that ar_low[i] = number of elements lower than or equal to ar[i] in ar[i+1:n-1].
So the output of above should be {0,2,1,2,2,1,0} Time complexity : O(n) use of extra space allowed.


µÈ¼ÛÓÚÇ°ÃæÒ»¸öÇóÄæÐò¶ÔµÄÌâµÄ°É£¬¸Ð¾õ²»¿ÉÄÜ×öµ½O(N),



249. ¸øÒ»´®Êý×Ö£¨±ÈÈç˵1£¬4£¬10£¬22£¬30£¬±íʾ4¸öÇø¼ä£º[1£¬4]£¬£¨4£¬10]£¬£¨10£¬22]£¬£¨22£¬30]£©¡£ÏÖÔÚ¸øºÜ¶à¸öÊý×Ö£¬ÒªÉè¼ÆÒ»¸ö¿ìËÙËã·¨£¬ÄÜÓÃ×î¿ìµÄËٶȸæËßÄÇЩÊý×Ö·Ö±ðÂäÔÚÄĸöbucketÄÇÀï¡£±ÈÈç˵ǰÃæÕâ¸öÀý×ÓÊäÈëdoubleÊý13£¬Ëã·¨·µ»Østring: ¡°(10,22]¡±£»ÊäÈëdouble[]ÐòÁÐ13£¬8£¬25£¬·µ»Østring[] ¡°(10,22]¡± ¡°(4,10]¡± ¡°(22,30]¡±


TO LEARN£¬ INTERVAL TREE



250. Given Numerator and Denominator. After division you might get a recurring decimal points float as the answer. You need to identify the recurring part For example 23.34563456 ¡­ return 3456


CODE



251. A positive integer is said to be square free if it is divisible by no perfect square larger than 1. For example, the first few squarefree numbers are {1, 2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 19, ¡­}. Find the nth smallest squarefree number. Note n can be very large such as 1M.


ÏÈÕÒ³ösqrt(n)ÒÔÄÚµÄËùÓÐÖÊÊý¡£¡£ÔÙÏëÏë



252.ÅжÏÒ»¸östringÊÇ·ñÊÇij¸öpatternµÄÖÜÆÚÑ­»·


TO LEARN£¬ºó׺Ê÷£¿



253. ÔÚÒ»¸öN Dimensional µÄÕý·½ÐÎÀïÃ棬Assume the top right point is (n,n,¡­. n) and bottom left point is (0, 0, 0¡­. 0), given any point in the cube, find all the paths inside the cube to the (n, n,¡­n) around it, change its value to 1. Otherwise, mark its value to 0 (cannot recall exactly anymore). how to do it. Given a very big such matrix and n computer, how to do it efficiently. Assume each computer has very limited memory, how to do it.


TO LEARN



254. ¸ø¸öÊý×飬ûÅÅÐò£¬ÒÑÖªÊý×éÖÐÿ¸öÔªËؾàÀëÅÅÐòÒÔºóµÄλÖÃ×î¶àÊÇk£¬ÈÃÄã¸øÕâ¸öÊý×éÅÅÐò


TO LEARN, ShellÅÅÐò£¿



255.Á½¸öÏ߶ÎÊý×飬ÇócommonÇø¼ä A£Û1£¬5£Ý£Û10£¬15£ÝB [3,12] return [3,5],[10,12]


TO LEARN, Interval tree



256. minimum window cover


TO LEARN



257. Given a sorted array of n integers, pick up k elements so that the minimal difference between consecutive elements is maximal (that is choose the elements to maximize the quantity min(a[i+1] ¨C a[i]))


DPÌ⣬дµÝÍƹ«Ê½


Ê×Ò³ ÉÏÒ»Ò³ 1 2 3 ÏÂÒ»Ò³ βҳ 3/3/3
¡¾´ó ÖРС¡¿¡¾´òÓ¡¡¿ ¡¾·±Ìå¡¿¡¾Í¶¸å¡¿¡¾Êղء¿ ¡¾ÍƼö¡¿¡¾¾Ù±¨¡¿¡¾ÆÀÂÛ¡¿ ¡¾¹Ø±Õ¡¿ ¡¾·µ»Ø¶¥²¿¡¿
ÉÏһƪ£º³ÌÐòÔ±ÃæÊÔÒ»°ã»áÎÊÄÄЩÎÊÌâ,ÒÔ¹©.. ÏÂһƪ£º.NET»ù´¡ÃæÊÔÌâ

×îÐÂÎÄÕÂ

ÈÈÃÅÎÄÕÂ

Hot ÎÄÕÂ

Python

C ÓïÑÔ

C++»ù´¡

´óÊý¾Ý»ù´¡

linux±à³Ì»ù´¡

C/C++ÃæÊÔÌâÄ¿