摘要:
1.浏览器的返回功能可以用栈来实现,当前浏览的页面我们叫它为栈顶元素,跳转到一个新页面我们叫元素入栈,点击“返回”按钮我们叫元素出栈,当然出栈前提是栈里要有元素,比如在浏览器里,如果已经返回到了最开始的页面,那就无法返回了。栈有一个重要的性质,就是先进后出,First In Last Out(FIL 阅读全文
摘要:
问题: Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exi 阅读全文
摘要:
题目: According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician J 阅读全文
摘要:
问题: Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and 阅读全文
摘要:
题目: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the 阅读全文
摘要:
题目: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. 阅读全文
摘要:
new int;//开辟一个存放整数的存储空间,返回一个指向该存储空间的地址(即指针) new int(100);//开辟一个存放整数的空间,并指定该整数的初值为100,返回一个指向该存储空间的地址 new char[10];//开辟一个存放字符数组(包括10个元素)的空间,返回首元素的地址 new int[5][4];//开辟一个存放二维整型数组(大小为5*4)的空间,返回首... 阅读全文
摘要:
题目: Given an integer (signed 32 bits), write a function to check whether it is a power of 4. Example:Given num = 16, return true. Given num = 5, retur 阅读全文