443. String Compression
שאלה שניה הייתה על מערכת שהם הביאו ציור שלה וביקשו לממש בדיקות על מערכת 1 הביאו לי API כזה וביקשו לרשום פונקציה שמבצעת את 3 הבדיקות שאני חושבת לנכון :
Describe a testing algorithm to verify the data path between System
Implement the algorithm in code.
and the flash memory.
Available API:
set_system power (system id, power_state) - Powers on/off System 1 or System 2 set_mux_channel(channel) -
Configures the mux to route data between the flash and System 1 or System 2
read_flash (addr) - Returns data at the given address. Returns null if the flash is not connected; returns OxFF for an empty (unprogrammed) address.
write_flash(addr, data) - Writes data to the given address. No return value.
שאלה שלישית חזרנו לקוד של שאלה 1 ועכשיו עשו לה הרחבה (לא ביקשו לכתוב רק בעל פה) למצוא את תת-המחרוזת המחזורית הקצרה ביותר
עליך לבנות רכיב בעל כניסה אחת (סיגנל) ושתי יציאות:
SA1 - יוציא 1 אם הרכיב תקוע על 1
SA0 - יוציא 1 אם הרכיב תקוע על 0
מספיק שינוי אחד על מנת ששניהם יהיו ב0.