×¢²áһĶÈý·ÖµØÂÛ̳£¬²é¿´¸ü¶à¸É»õ£¡
ÄúÐèÒª µÇ¼ ²Å¿ÉÒÔÏÂÔØ»ò²é¿´¸½¼þ¡£Ã»ÓÐÕʺţ¿×¢²áÕ˺Å
x
Çó´óÃ×Çó´óÃס«¡« ¸Ðл´ó¼ÒÇó´óÃ×£¡£¡
Karat ×ܹ²60·ÖÖÓ£¬È«³Ì¿ªÉãÏñÍ·¡£
1.×ÔÎÒ½éÉÜ
2. 10·ÖÖÓcs֪ʶ¿ìÎÊ¿ì´ð£¬5¸öÁìÓòÑ¡2¸ö»Ø´ð£¬
ÎÒÑ¡ÁË production issueºÍtest£¬»¹ÓÐfront end£¬ÒÔ¼°ÁíÍâÁ½¸ö²»¼ÇµÃÁË¡£¡£
3. 45·ÖÖÓ×öÌ⣬¾Ý˵ÊÇ×öµÃÔ½¶à¶àÔ½ºÃ£¬ÎÒ×öÁËÄúºÃ£¡ ±¾ÌûÒþ²ØµÄÄÚÈÝÐèÒª»ý·Ö¸ßÓÚ 188 ²Å¿Éä¯ÀÀ Äúµ±Ç°»ý·ÖΪ 0¡£ ʹÓÃVIP¼´¿Ì½âËøÔĶÁȨÏÞ»ò²é¿´ÆäËû»ñÈ¡»ý·ÖµÄ·½Ê½ Óοͣ¬ÄúºÃ£¡ ±¾ÌûÒþ²ØµÄÄÚÈÝÐèÒª»ý·Ö¸ßÓÚ 188 ²Å¿Éä¯ÀÀ Äúµ±Ç°»ý·ÖΪ 0¡£ VIP¼´¿Ì½âËøÔĶÁȨÏÞ »ò ²é¿´ÆäËû»ñÈ¡»ý·ÖµÄ·½Ê½ ¶È¡£- You're developing a system for scheduling advising meetings with students in a Computer Science program. Each meeting should be scheduled when a student has completed 50% of their academic program.
- Each course at our university has at most one prerequisite that must be taken first. No two courses share a prerequisite. There is only one path through the program.
- Write a function that takes a list of (prerequisite, course) pairs, and returns the name of the course that the student will be taking when they are halfway through their program. (If a track has an even number of courses, and therefore has two "middle" courses, you should return the first one.)
- Sample input 1: (arbitrarily ordered)
- pairs1 = [
- ["Foundations of Computer Science", "Operating Systems"],
- ["Data Structures", "Algorithms"],
- ["Computer Networks", "Computer Architecture"],
- ["Algorithms", "Foundations of Computer Science"],
- ["Computer Architecture", "Data Structures"],
- ["Software Design", "Computer Networks"]
- ]
- In this case, the order of the courses in the program is:
- Software Design
- Computer Networks
- Computer Architecture
- Data Structures
- Algorithms
- Foundations of Computer Science
- Operating Systems
- Sample output 1:
- "Data Structures"
- Sample input 2:
- pairs2 = [
- ["Algorithms", "Foundations of Computer Science"],
- ["Data Structures", "Algorithms"],
- ["Foundations of Computer Science", "Logic"],
- ["Logic", "Compilers"],
- ["Compilers", "Distributed Systems"],
- ]
- Sample output 2:
- "Foundations of Computer Science"
- Sample input 3:
- pairs3 = [
- ["Data Structures", "Algorithms"],
- ]
- Sample output 3:
- "Data Structures"
- All Test Cases:
- halfway_course(pairs1) => "Data Structures"
- halfway_course(pairs2) => "Foundations of Computer Science"
- halfway_course(pairs3) => "Data Structures"
- Complexity analysis variables:
- <div>n: number of pairs in the input</div>
¸´ÖÆ´úÂë Çó´óÃ×Çó´óÃס«¡« ¸Ðл´ó¼Ò!Çó´óÃ×£¡£¡
|