由买买提看人间百态

topics

全部话题 - 话题: nitems
(共0页)
c*****t
发帖数: 1879
1
来自主题: Programming版 - just had an interview
I was interviewing for a principle software engineer / architect
position. The manager also gave me an offline interview question.
I did not give it much thought and sent the solution back. Then
I googled the problem afterward. It was the same as this one.
https://github.com/deepsolo9/interview/tree/master/amazon
The solution there was very bad. Obvious problems you can spot:
1. macros should not be defined in the header file. These macros are
strickly for the implementation, and not for... 阅读全帖
d****i
发帖数: 4809
2
来自主题: Programming版 - 两行quicksort,不难些吧
Plain old vanilla pure C code. Disclaimer: copied from online
#include
#include
static void swap(void *x, void *y, size_t l) {
char *a = x, *b = y, c;
while(l--) {
c = *a;
*a++ = *b;
*b++ = c;
}
}
static void sort(char *array, size_t size, int (*cmp)(void*,void*), int
begin, int end) {
if (end > begin) {
void *pivot = array + begin;
int l = begin + size;
int r = end;
while(l < r) {
if (cmp(array+l,pivot) <= 0) {
... 阅读全帖
f*******m
发帖数: 94
3
来自主题: Statistics版 - 还是SAS的简单问提!
正在非常努力地学SAS,又来麻烦大家了,如果问题问的太简单,大家请随便笑话+鄙视。
还是关于SAS的一个应该是很简单很简单的问题,请走过的路过的帮个忙,先谢过了。
我有一段code是这样的:
do i=1 to &NITEMS;
if x(i)=c(i) then s(i)=1;
if x(i)~=c(i) then s(i)=0;
end;
请问我如何才能将 if x(i)=0 then s(i)= ".";加入到这段Code当中呢?
其实就是x(i) 中有的数值是0, 1,2,3,4 而从c(i)中只有1,2,3,4。 所以如果
不加if x(i)=0 then s(i)= "."; 然后本来应该missing就直接变成0 了,这不是我想
要的。
(共0页)