javascript建立對象總結(javascript進階程式設計),javascript程式設計 1.原廠模式這種模式抽象建立具體對象的過程,用函數封裝特定的介面來建立類。 function createStudent(name) { var o = new Object(); o.name = name; o.sayName = function() { alert(this.name); };
採用em標籤製作的列表三角形標號,em標籤三角形標號<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html
Codeforces 528A Glass Carving STL類比,codeforces528a題目連結:點擊開啟連結題意:給定n*m的矩陣,k個操作2種操作:1、H x 橫向在x位置切一刀2、V y 豎直在y位置切一刀每次操作後輸出最大的矩陣面積思路:因為行列是不相干的,所以只要知道每次操作後行的最大間距和列的最大間距,相乘就是最大面積用一個set維護橫向的所有座標點,一個multiset維護橫向的間距。每次對行操作x則在set中找到比x大的最小數 r 和比x小的最大數l
Min Stack,minstack Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) – Push element x onto stack.pop() – Removes the element on top of the stack.top() – Get the top element.getMin() –
Majority Element,majorityelement Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element always exist in
Valid Palindrome,validpalindrome Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race a car” is not a palindrome.Note: