LeetCode 41:原地算法寻找缺失最小正数
2026/8/13 2:13:29
在 RPC(远程过程调用)的应用场景中,我们先来看一个模拟高尔夫游戏的例子。这里有两个关键函数:StartGolf和EndGame。
StartGolf函数用于开启一个新的高尔夫游戏玩家的游戏进程,其代码如下:
RPC STATUS StartGolf ( CHAR *pchPlayerName, PPGOLF_GAME_CONTEXT pphContext ) { *pphContext = NULL; if (iCurrentPlayer >= MAX_PLAYERS) return GOLF_COURSE_TOO_BUSY; // Find a convenient slot for new player while (int i = 0; i < MAX_PLAYERS; i++) { if (Players[i].fSlotTaken == FALSE) break; } *pphContext = &Players[i]; // Set up the slot with proper data Players[i].fSlotTaken = TRUE; Players[i].iPlayerNos = i; // Bump the current usage count iCurrentPla