由买买提看人间百态

topics

全部话题 - 话题: integer
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)
i*********n
发帖数: 58
1
来自主题: JobHunting版 - A家面试题
You only need to store the difference between sorted integers. In total
there are 2^32 = 4G integers and we are sorting 1M of them. So max
difference between two sorted integer should be around 4000 which needs 12
bits to store. Sorting 1M integer needs about 12 MBits. We have 2M RAM which
is 2 * 8 = 16 MBits. We only need to store the min integer and others just
the difference. Also, you do not need to store first and then sort. Just
sort them on the fly. The sort will be very expensive, but s... 阅读全帖
g*****e
发帖数: 282
2
给定时间内只完成对O(MN)的优化,没能想出O(M+N)。感觉这题目挺有意思的现在
继续想,欢迎bs,欢迎版友讨论 =)
A new kind of cannon is being tested. The cannon shoots cannonballs in a
fixed direction. Each cannonball flies horizontally until it hits the ground
, and then it rests there. Cannonballs are shot from different heights, so
they hit the ground at different points.
You are given two zero-indexed arrays, A and B, containing M and N integers
respectively. Array A describes the landscape in the direction along which
the cannon is shooting... 阅读全帖
a********y
发帖数: 1262
3
来自主题: JobHunting版 - 请教leetcode上的count and say
private static java.util.Hashtable cache = new java.util.
Hashtable();
public String countAndSay(int n)
{
// Start typing your Java solution below
// DO NOT write main() function
Object result = cache.get(new Integer(n));
if(result != null)
{
return (String)result;
}
if(n == 1)
{
cache.put(new Integer(1), "1");
return "1";
}
e... 阅读全帖
e****e
发帖数: 418
4
Any hidden trick?
Here is my Java code.
Integer[] findLocalMaxima(int[] a) {
if ( a == null || a.length == 0 )
throw new RuntimeException();

List list = new ArrayList();
for ( int i = 1; i < a.length - 1; i++ ) {
if ( a[i] > a[i-1] && a[i] > a[i+1] )
list.add( a[i] );
}
return (Integer[])list.toArray(new Integer[]{});
}
I*********e
发帖数: 61
5
来自主题: JobHunting版 - 请教一道Leetcode 题, 多谢
Reverse Integer
Reverse digits of an integer.
Example1: x = 123, return 321
Example2: x = -123, return -321
Have you thought about this?
Here are some good questions to ask before coding. Bonus points for you if
you have already thought through this!
If the integer's last digit is 0, what should the output be? ie, cases such
as 10, 100.
Did you notice that the reversed integer might overflow? Assume the input is
a 32-bit integer, then the reverse of 1000000003 overflows. How should you
handle su... 阅读全帖
s*********s
发帖数: 140
6
如题。用的是judge large。
是什么原因呢? code如下。或者看链接:http://pastebin.com/juCshJA6
public class Solution {
public ArrayList> fourSum(int[] num, int target) {
// Start typing your Java solution below
// DO NOT write main() function
Arrays.sort(num);
ArrayList> result = new ArrayList>
();
for (int i = 0; i < num.length - 3;) {
for (int j = i + 1; j < num.length - 2;) {

int k = j + 1;
... 阅读全帖
s****0
发帖数: 117
7
package myutil;
import java.util.Scanner;
import java.util.Stack;
public class ParseExp {
Stack oprand = new Stack();
Stack oprator = new Stack();
static int[] code = new int[256];
static {
code['+'] = 10;
code['-'] = 11;
code['*'] = 20;
code['/'] = 21;
code['^'] = 30;
code['$'] = 0;
code['('] = 100;
code[')'] = 1;
}
public ParseExp() {
}
public Integer parse(String... 阅读全帖
s****0
发帖数: 117
8
package myutil;
import java.util.Scanner;
import java.util.Stack;
public class ParseExp {
Stack oprand = new Stack();
Stack oprator = new Stack();
static int[] code = new int[256];
static {
code['+'] = 10;
code['-'] = 11;
code['*'] = 20;
code['/'] = 21;
code['^'] = 30;
code['$'] = 0;
code['('] = 100;
code[')'] = 1;
}
public ParseExp() {
}
public Integer parse(String... 阅读全帖
l***i
发帖数: 1309
9
来自主题: JobHunting版 - 一个实际碰到的问题
suppose you are looking for all 8-bit integer with hamming distance at most
3 with a given integer 10010010, then you can generate all possible 8-bit
integers and try each of them to see if it is in your hashmap.
For 64-bit integers, only (64 choose 3) positions can be different, for each
of the 3 positions you have at most 2^3 bit patterns, so you
only have (64 choose 3) * 2^3 = 10^6 integers to search in your hashmap,
should be
done in less than 1 sec.
p*****2
发帖数: 21240
10
来自主题: JobHunting版 - 今天计划做20题

Id Question Difficulty Freqency Data Structures Algorithms
1 Two Sum 2 5
array
set
sort
two pointers
2 Add Two Numbers 3 4
linked list
two pointers
math
3 Longest Substring Without Repeating Characters 3 2
string
hashtable
two pointers
4 Median of Two Sorted Arrays 5 3
array
binary search
5 Longest Palindromic Substring 4 2
string
6 ZigZag Conversion 3 1
string
7 Reverse Integer 2 3
math
8 ... 阅读全帖
l*******0
发帖数: 63
11
来自主题: JobHunting版 - 求个4sum的算法
A solution that could deal with dups. O(N^3).
public ArrayList> fourSum(int[] num, int target) {
int len=num.length;
Arrays.sort(num);
ArrayList> results=new ArrayList Integer>>();
for(int i=0;i if(i-1>=0&&num[i]==num[i-1]) continue; //skip dup in outmost
loop
for(int j=i+1;j if(j-1>=i+1&&num[j]==num[j-1]) continue; //skip dup in 2nd
outmost loop
... 阅读全帖
P**l
发帖数: 3722
12
来自主题: JobHunting版 - G等消息中 求bless
写了个
String divide(int a, int b) {
Integer k = a /b;
a %= b;
if (a == 0) return k.toString();
Map m = new HashMap();
StringBuilder sb = new StringBuilder();
sb.append('.');
int i = 1;
while (true) {
if (m.containsKey(a)) break;
m.put(a, i);
a *= 10;
if (a != 0 && b!= 0) sb.append(a/b);
a %= b;
}
if (a != 0) {
sb.append(')');
sb.insert(m.get(a).intValue(), '(');
}
sb.insert(0... 阅读全帖
l*n
发帖数: 529
13
来自主题: JobHunting版 - 请教一道interval的题目
描述得看不懂啊。写了个感觉比较简明的,就是对所有不可再分的区间进行计数。
排序O(nlogn)+查找O(2*nlogn)+计数O(n*m),其中m是平均区间分割数。
List mostOverlapped(Interval[] ints) {
Set set = new HashSet();
for (Interval itv : ints) {
set.add(itv.start);
set.add(itv.end);
}
// all candidate intervals;
List ends = new ArrayList(set);
Collections.sort(ends);
int max = 0;
// count overlapped times of each candidates
int[] counts = new int[ends.size()];
for (i... 阅读全帖
y**********a
发帖数: 824
14
public List quack(Queue q) {
DoublyListNode head=new DoublyListNode(Integer.MIN_VALUE);
DoublyListNode tail=new DoublyListNode(Integer.MAX_VALUE);
DoublyListNode first=head;
DoublyListNode last=tail;
while (!q.isEmpty()) {
int v=q.poll();
DoublyListNode node=new DoublyListNode(v);
if (first.val>v) {
head.after=node;
node.after=first;
node.before=head;
... 阅读全帖
y**********a
发帖数: 824
15
public List quack(Queue q) {
DoublyListNode head=new DoublyListNode(Integer.MIN_VALUE);
DoublyListNode tail=new DoublyListNode(Integer.MAX_VALUE);
DoublyListNode first=head;
DoublyListNode last=tail;
while (!q.isEmpty()) {
int v=q.poll();
DoublyListNode node=new DoublyListNode(v);
if (first.val>v) {
head.after=node;
node.after=first;
node.before=head;
... 阅读全帖
t********o
发帖数: 10
16
来自主题: JobHunting版 - 多家的面经
具体哪些公司就不提了,反正就是版上的那些大公司,把能记住的电面onsite题就混在
一块儿了。
1. anagram
2. OO design: candy bar
3. sort color
4. 给一个小写的string,例如“abcd” 输出所有大小写混合的组合
5. string to double
6. given a string words, find the shortest substring including all the given
key words
7. what is little/big endian, how to tell if one machine is little or big
endian machine?
8. power set
9. smart pointer
10. given a set of weighted intervals, find the set non-overlap weighted
intervals that has the biggest weight
11. two sum变形
12. serialize... 阅读全帖
t********o
发帖数: 10
17
来自主题: JobHunting版 - 多家的面经
具体哪些公司就不提了,反正就是版上的那些大公司,把能记住的电面onsite题就混在
一块儿了。
1. anagram
2. OO design: candy bar
3. sort color
4. 给一个小写的string,例如“abcd” 输出所有大小写混合的组合
5. string to double
6. given a string words, find the shortest substring including all the given
key words
7. what is little/big endian, how to tell if one machine is little or big
endian machine?
8. power set
9. smart pointer
10. given a set of weighted intervals, find the set non-overlap weighted
intervals that has the biggest weight
11. two sum变形
12. serialize... 阅读全帖
x******0
发帖数: 178
18
来自主题: JobHunting版 - sliding window max
虽然是老题,但是写起来还是很费劲,唉。。
public static ArrayList SlidingWindowMax(int[] arr, int windowSize){
//edge case

ArrayList res = new ArrayList();
ArrayDeque indexQ = new ArrayDeque();
for (int i = 0; i < windowSize; i++){
while (!indexQ.isEmpty() && arr[i] > indexQ.getLast()){
indexQ.pollLast();//only keep possible max
}
indexQ.add(i);
}

for (int i... 阅读全帖
m*****k
发帖数: 731
19
@Test
public void testFootballCombinationSum(){
int[] scores = {6,2,1};
footballCombinationSum(10, scores);
}
*****************************************************
public void footballCombinationSum( int total , int[] scores){

Map scoresUsed = new HashMap<>();
footballCombinationSumNoDup( scoresUsed, total, scores, 0 );
}


private void footballCombinationSumNoDup( Map
scoresUsed , int total... 阅读全帖
f********c
发帖数: 147
20
这题试了好几个办法总是通不过,按说不难的,求帮忙看看,谢谢!
public class Solution {
public List> levelOrder(TreeNode root) {
List> result = new ArrayList>();
if(root == null) return result;
Queue current = new LinkedList(); //store
current level TreeNode
current.add(root);
List levelValue = new ArrayList(); //store
elements in current level
while(!current.isEmpty()) {
Queue阅读全帖
y**********a
发帖数: 824
21
没有问题,以下是 hashcode 的 contract:
Whenever it is invoked on the same object more than once during
an execution of a Java application, the {@code hashCode} method
must consistently return the same integer, provided no information
used in {@code equals} comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
If two objects are equal according to the {@code equals(Object)}
method, then calling the ... 阅读全帖
y**********a
发帖数: 824
22
没有问题,以下是 hashcode 的 contract:
Whenever it is invoked on the same object more than once during
an execution of a Java application, the {@code hashCode} method
must consistently return the same integer, provided no information
used in {@code equals} comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
If two objects are equal according to the {@code equals(Object)}
method, then calling the ... 阅读全帖
h***k
发帖数: 161
23
来自主题: JobHunting版 - java的基本问题
List> t = new ArrayList>();
list是interface,建instance的时候要用实体class,比如arraylist
但是里面那一层只是declaration,所以还是要写成list
List> t = new ArrayList>();
往里面加东西的时候,里面一层也要用实体class:
t.add(new ArrayList);
e********2
发帖数: 495
24
This should be the optimal:
Map[] maps = new Hashmap[26];
for(String s : strings){
// aabbcd then n = 4
int n = distinct characters in s;
// aabbcd then binary representation is 0b111100000000000000
int m = s's bit pattern;
// maps[n-1].get(m) stores the longest string with the same set
// of distinct chars
Integer maxlength = maps[n-1].get(m);
maps[n - 1].put(m, maxlength == null ? s.size() : Math.max(s.size(), max
length));
}... 阅读全帖
S*******C
发帖数: 822
25
来自主题: JobHunting版 - lintcode delete digits怎么做?
Delete Digits
12%
Accepted
Given string A representative a positive integer which has N digits, remove
any k digits of the number, the remaining digits are arranged according to
the original order to become a new positive integer. Make this new positive
integers as small as possible.
N <= 240 and k <=N,
Example
Given an integer A = 178542, k = 4
return a string "12"
Tags Expand
Greedy
public class Solution {
/**
*@param A: A positive integer which has N digits, A is a string.
*@par... 阅读全帖
S*******C
发帖数: 822
26
来自主题: JobHunting版 - lintcode delete digits怎么做?
Delete Digits
12%
Accepted
Given string A representative a positive integer which has N digits, remove
any k digits of the number, the remaining digits are arranged according to
the original order to become a new positive integer. Make this new positive
integers as small as possible.
N <= 240 and k <=N,
Example
Given an integer A = 178542, k = 4
return a string "12"
Tags Expand
Greedy
public class Solution {
/**
*@param A: A positive integer which has N digits, A is a string.
*@par... 阅读全帖
m***2
发帖数: 595
27
来自主题: JobHunting版 - 求解lintcode Majority Number III
ac的一个,不知道是不是最优
public class Solution {
/**
* @param nums: A list of integers
* @param k: As described
* @return: The majority number
*/
public int majorityNumber(ArrayList nums, int k) {
if (nums == null || nums.size() == 0 || k > nums.size() || k <= 0) {
return Integer.MAX_VALUE;
}

int[] value = new int[k];
int[] count = new int[k];
for (int i = 0; i < k; i++) {
count[i] = 0;
}
... 阅读全帖
d*******8
发帖数: 23
28
来自主题: JobHunting版 - 国内找北美社招职位面试总结
版中大多数面经都是针对北美new graduate的, 在此贡献一下本人国内找北美工作的一
些经验吧, 也算是答谢mitbbs上分享面经的朋友对我的帮助. 更希望攒攒人品能够抽到
h1b签证 :)
[背景]
国内4年工作经验. 硕士毕业后一直在某做存储的外企工作.
14年7月份开始有出国打算并开始准备.
[准备]
在工作之余每天坚持至少刷3~4道算法题, 并关注各个公司的blog及github上的开源项
目.
1. 算法
Leetcode自然不必说, 必刷. 先是用了将近两个月的时间把leetcode刷了1.5遍, 然
后每次电面和onsite面之前挑一些觉得做得不好的题再刷.

其次就是看geeksforgeeks上题. 这是个老印host的网站, 但是上面的题目分类明晰
,有很多分类底下的题目非常好, 比如DP (印象最深的就是m个鸡蛋n层楼测在哪层楼鸡
蛋会被摔碎的问题)和graph (印象最深的就是单源/多源最短/最长路径和欧拉环). 每
天看一下还是能学到不少新鲜的知识的.

其他就没有了, career up和glass door也断断续续看了一些, ... 阅读全帖
d*******8
发帖数: 23
29
来自主题: JobHunting版 - 国内找北美社招职位面试总结
版中大多数面经都是针对北美new graduate的, 在此贡献一下本人国内找北美工作的一
些经验吧, 也算是答谢mitbbs上分享面经的朋友对我的帮助. 更希望攒攒人品能够抽到
h1b签证 :)
[背景]
国内4年工作经验. 硕士毕业后一直在某做存储的外企工作.
14年7月份开始有出国打算并开始准备.
[准备]
在工作之余每天坚持至少刷3~4道算法题, 并关注各个公司的blog及github上的开源项
目.
1. 算法
Leetcode自然不必说, 必刷. 先是用了将近两个月的时间把leetcode刷了1.5遍, 然
后每次电面和onsite面之前挑一些觉得做得不好的题再刷.

其次就是看geeksforgeeks上题. 这是个老印host的网站, 但是上面的题目分类明晰
,有很多分类底下的题目非常好, 比如DP (印象最深的就是m个鸡蛋n层楼测在哪层楼鸡
蛋会被摔碎的问题)和graph (印象最深的就是单源/多源最短/最长路径和欧拉环). 每
天看一下还是能学到不少新鲜的知识的.

其他就没有了, career up和glass door也断断续续看了一些, ... 阅读全帖
M**********g
发帖数: 59
30
其实再store的方法加个synchronized 就可以了,
每当有线程调用store方法的时候,这个对象就上锁了,其他线程就不能访问了。
下面是原题,和我写的实现
public interface TwoSum {
/**
* Stores @param input in an internal data structure.
*/
void store(int input);

/**
* Returns true if there is any pair of numbers in the internal data
structure which
* have sum @param val, and false otherwise.
* For example, if the numbers 1, -2, 3, and 6 had been stored,
* the method should return true for 4, -1, and 9, but false for 10, ... 阅读全帖
c**z
发帖数: 669
31
来自主题: JobHunting版 - 请教下3sum为撒超时
public class Solution {
public List> threeSum(int[] num) {
Arrays.sort(num);
List> ret = new ArrayList>();


for( int i=0 ;i {
int j=i+1;
int k=num.length - 1;
while(j {
int sum = num[i] + num[j] + num[k];
if ( sum == 0)
{
ArrayList temp = new ArrayList阅读全帖
e********2
发帖数: 495
32
来自主题: JobHunting版 - 问道G的onsite题
1)
for( int i : nums ){
find path p : i --> to the root;
if(p contains Integer.MAX_VALUE or node to be deleted somewhere)
then set the nodes between i (inclusive) and Integer.MAX_VALUE to
Integer.MAX_VALUE;
}
2)
compact the pierced array:
Say, exchange i and Integer.MAX_VALUE at j:
nums[j] = nums[i]
nums[i] = - j - 1;
3)
for( j in those not change position with Integer.MAX_VALUE){
if(nums[nums[j]] < 0)
nums[j] = - nums[nums[j]] - 1;
}
k******a
发帖数: 44
33
Map的用法:Map() 一位面试官问我为什么要用Integer而不
是int
Map使用首先要得到key. Integer或者Object都是可以用.hashCode()得到这个key的,
int这样的原生类型没法得到key。
你可以调用的时候使用int类型,但是系统自动box转换为Integer Object。
Y*S
发帖数: 74
34
来自主题: JobHunting版 - 面试题求解
毕业很多年了。 现在有个面试题要求完成,读完后完全没有头绪,帮忙看看该怎么做
?万分感谢。
Ms.Kox enjoys her job, but she does not like to waste extra time traveling
to and from her office. After working for many years, she knows the shortest
-distance route to her office on a regular day.
Recently, the city began regular maintenance of various roads. Every day a
road gets blocked and no one can use it that day, but all other roads can be
used. You are Ms. Kox's new intern and she needs some help. Every day, you
need to determine the minim... 阅读全帖

发帖数: 1
35
A zero-indexed array A consisting of N different integers is given. The
array contains all
integers in the range [0..N - 1]. Sets S[K] for 0 <= K < N are defined as
follows:
S[K] = { A[K], A[A[K]], A[A[A[K]]], ... }.
Sets S[K] are finite for each K.
Write a function:
class Solution { public int solution(int[] A); }
that, given an array A consisting of N integers, returns the size of the
largest set S[K]
for this array. The function should return 0 if the array is empty.
For example, given array ... 阅读全帖

发帖数: 1
36
来自主题: JobHunting版 - 上午偷闲把TopKFrequentWords写出来了
我写的:
class Solution {
public List topKFrequentWords(String[] words, int k) {
Map map = new HashMap<>();
for (String word : words) {
map.put(word, map.getOrDefault(word, 0) + 1);
}

PriorityQueue> pq = new PriorityQueue<>(
(n1, n2) -> n2.getValue() - n1.getValue());
for (Map.Entry entry : map.entrySet()) {
pq.offer(entry);
}

List... 阅读全帖
s****h
发帖数: 3979
37
CREATE TABLE Match
(
player1 integer,
player2 integer,
score varchar(10)
)
CREATE TABLE Players
(
ID integer,
name varchar(10)
)
insert into Match
values
( 3, 2, '3:1'),
( 2, 1, '3:1'),
( 3, 1, '3:1'),
( 1, 2, '3:1'),
( 1, 3, '3:1'),
( 2, 3, '3:1')
insert into Players
values (1, 'A'),
(2, 'B'),
(3, 'C')
declare @P1 integer
declare @P2 integer
set @P1 = 1;
set @P2 = 3;
select P1.name, P2.name, M.score
from Match M
join Players P1 on P1.id = M.player1
join Players p2 on P2.id = M.player2
where (P1... 阅读全帖
t******n
发帖数: 2939
38
☆─────────────────────────────────────☆
btphy (btphy) 于 (Sat May 25 03:19:10 2013, 美东) 提到:
版上弱智真多,这么简单的问题都搞不清楚。证明如下。
exp(2i pi e)=(exp(2i pi) )^e=1^e=1
==> 2i pi e=ln(1)=0
==> pi e=0
证毕。
★ 发自iPhone App: ChineseWeb 7.7
☆─────────────────────────────────────☆
feverpitch (狂热) 于 (Sat May 25 05:42:46 2013, 美东) 提到:
这个问题很难啊

☆─────────────────────────────────────☆
heathen (The real folk blues) 于 (Sat May 25 05:57:11 2013, 美东) 提到:
不难。刚才搞错了,LZ的公式“正确”。不过还可以更简单。
exp(2*i*pi)=1 ==> 2*i*pi=ln(1... 阅读全帖
s*******n
发帖数: 1392
39
来自主题: Henan版 - [合集] 做题有包子
☆─────────────────────────────────────☆
eastsun26 (太阳神Helios) 于 (Fri Mar 16 23:17:12 2007) 提到:
1。 A wire that weighs 24 kilograms is cut into two pieces so that one of
the pieces weighs 16 kilograms and is 34 meters long. If the weight of each
piece is proportional to its length, how many meters long is the other
piece of wire? ( )
2。The sum of three integers is 40. The largest integer is 3 times the
middle integer, and the smallest integer is 23 less than the largest integer
.
s******n
发帖数: 876
40
来自主题: Java版 - type erasure weird problem
I read it somewhere but I can't be sure I remember it clearly.
Apparently, even before Generics, at java byte code level,
a class is allowed to have two methods of same signature,
if they have different return types.
class A // pseudo byte code
f(List)->String
f(List)->Integer
The byte code reference to a method actually includes the
return type, therefore the two methods can be distinguished.
// pseudo byte code invoking two methods
(A.f(List)->String) ();
(A.f(List)->Integer) ();
Of ... 阅读全帖
r*****l
发帖数: 2859
41
来自主题: Java版 - 问一个 java generic问题
This is kinda tricky.
The compile just looks at the declaration to determine the type.
In the IOException example, you know the list can hold "a type" that is IOException's parent class (the exact type is not known). It's ok to add FileNotFoundException since FileNotFoundException is IOException's child, and for sure FileNotFoundException is IOException's parent's child. Without knowing what "a type" is, it's guaranteed that FileNotFoundException is safe to put in the list.
In the Number example... 阅读全帖
r****4
发帖数: 168
42
来自主题: Java版 - leetcode请教: time complexy
我在做leetcode,这个是要求所有push, pop, top, getMin, 时间消耗都是常量。
这个是我的code,
class MinStack {
List stack = new ArrayList();
List mins = new ArrayList();
int min = 0;
public void push(int x) {

stack.add(x);
if(mins.isEmpty() || x < min) {
mins.add(stack.size());
min = x;
}
}
public void pop() {
Integer temp = mins.get(mins.size() - 1 );
... 阅读全帖
s*********e
发帖数: 17
43
来自主题: Programming版 - 几道 google interview 的题目
1. Given N computers networked together, with each computer storing N integers
, describe a procedure for finding the median of all of the numbers. Assume
that a computer can only hold O(N) integers (i.e. no computer can store all N^
2 integers). Also assume that there exists a computer on the network without
integers, that we can use to interface with the computers storing the integers
.
2. Given the sequence S1 = {a,b,c,d,...,x,y,z,aa,ab,ac.... } and given that
this sequence corresponds (term
s******u
发帖数: 179
44
在fortran 90中,我将一个稀疏矩阵存成下面的数据格式:
TYPE:: rsm !Real sparse matrix
integer:: numbers !number of nonzero value in the matrix
integer,dimension(:),pointer::rows
integer,dimension(:),pointer::columns
real ,dimension(:),pointer::values
END TYPE rsm
然后用指针读取这个矩阵
TYPE:: rsmptr
type(rsm),pointer::p
END TYPE rsmptr
每次读取都是从第一个到后一个顺序读取。后面的程序中要对这个矩阵多次重复的读取(且是在内存中)
,这样的存法,读取的效率不怎么高。我也试过把一个矩阵中的元素存成一个node的数
据结构:
type:: node
integer :: rows
integer
c**********e
发帖数: 2007
45
来自主题: Programming版 - C++ Q93 - Q95 (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: careerchange (Stupid), 信区: JobHunting
标 题: C++ Q93 - Q95
发信站: BBS 未名空间站 (Fri Oct 14 23:32:57 2011, 美东)
C++ Q93: formal parameter T
What is the purpose of declaring the formal parameter T?
A. T specifies that any data sent to the function template must be of type T
B. T is a place-holder for a C++ data type
C. T can only hold a single data type int
D. T can hold any language data type
C++ Q94: Pointer
Multiple choices: Identify the true statements about the use of... 阅读全帖
Y*S
发帖数: 74
46
来自主题: Programming版 - 面试题求解 (转载)
【 以下文字转载自 JobHunting 讨论区 】
发信人: YES (NO,NO,NO), 信区: JobHunting
标 题: 面试题求解
发信站: BBS 未名空间站 (Sat Nov 26 01:00:25 2016, 美东)
毕业很多年了。 现在有个面试题要求完成,读完后完全没有头绪,帮忙看看该怎么做
?万分感谢。
Ms.Kox enjoys her job, but she does not like to waste extra time traveling
to and from her office. After working for many years, she knows the shortest
-distance route to her office on a regular day.
Recently, the city began regular maintenance of various roads. Every day a
road gets blocked and no one can use it that day, but all ... 阅读全帖
c*********s
发帖数: 63
47
终于弄好了。把下面的存成.bst文件,和Tex文件放在同一个文件夹就可以了。
%%
%% This is file `cellnew.bst',
%% generated with the docstrip utility, by HJ, 03/03/2013.
%%
%% The original source files were:
%%
%% merlin.mbs (with options: `ay,nat,nm-rvvc,nmlm,x10,x0,m10,m0,mcite,mct-1
,mct-x2,keyxyr,blkyear,dt-beg,yr-par,note-yr,atit-u,jttl-rm,thtit-a,vol-it,
vnum-x,volp-com,pp-last,num-xser,jnm-x,btit-rm,bt-rm,add-pub,pub-par,pre-pub
,edby,edbyy,blk-tit,ppx,ed,abr,ednx,xedn,jabr,url,url-blk,em-it,nfss,')
%% ----------------------... 阅读全帖
c*********s
发帖数: 63
48
终于弄好了。把下面的存成.bst文件,和Tex文件放在同一个文件夹就可以了。
%%
%% This is file `cellnew.bst',
%% generated with the docstrip utility, by HJ, 03/03/2013.
%%
%% The original source files were:
%%
%% merlin.mbs (with options: `ay,nat,nm-rvvc,nmlm,x10,x0,m10,m0,mcite,mct-1
,mct-x2,keyxyr,blkyear,dt-beg,yr-par,note-yr,atit-u,jttl-rm,thtit-a,vol-it,
vnum-x,volp-com,pp-last,num-xser,jnm-x,btit-rm,bt-rm,add-pub,pub-par,pre-pub
,edby,edbyy,blk-tit,ppx,ed,abr,ednx,xedn,jabr,url,url-blk,em-it,nfss,')
%% ----------------------... 阅读全帖
t********e
发帖数: 1169
49
【 以下文字转载自 JobHunting 讨论区 】
发信人: mitbbs59 (bEQi), 信区: JobHunting
标 题: 本版1年以内的所有 面经题目,含帖子link [为大家方便]
发信站: BBS 未名空间站 (Fri Jan 29 14:20:44 2010, 美东)
不敢保证全部涵盖,大部分的都在。
我自己找了一遍,大家一起用着都方便。
不过只是含有题目的帖子 我才包含进来了,只分享经验没贴题目的 我都没有包含
进来。
大家复习着方便。
1. 一个sorted interger Array[1...N], 已知范围 1...N+1. 已知一个数字missing。
找该数字。
把原题改为unsorted,找missing数字。 performance。
2. 复制linked list。 已知每个节点有两个pointer,一个指向后一个节点,另一个指向
其他任意一节点。 O(n)时间内,无附加内存,复制该linked list。(存储不连续)
3. 一个party N个人,如果一个人不认识任何其他人,又被任何其他人认识,此人为
celeb... 阅读全帖
首页 上页 1 2 3 4 5 6 7 8 9 10 下页 末页 (共10页)