程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[Python implementation of Huawei machine test] the longest continuous square wave signal

編輯:Python

List of articles

  • Preface
  • Title Description
  • Example 1
  • Reference code


Preface

《 Huawei machine test real problem 》 The column includes Huawei column of niuke.com 、 Huawei test questions 、 Huawei OD Real problem of machine test .

If you are preparing for Huawei's interview , If you want to know something, you can send me a private letter , I will try my best to help you , I can also give you some suggestions !

This paper solves the non optimal solution ( Non optimal performance ).

Title Description

Input a series of square wave signals , Find the longest completely continuous alternating square wave signal , And output it , If there are alternating square wave signals of the same length , Just output any , The square wave signal is used for high level 1 identification , In the low position 0 identification , Pictured :

explain :

  1. A complete signal must be in 0 Start with 0 ending , namely 010 It's a complete signal , but 101,1010,0101 No
  2. The input string of square wave signals is composed of one or more complete signals
  3. There may be... Between two adjacent signals 0 One or more low positions , Such as 0110010,011000010
  4. There can be consecutive high bits in the same signal , Such as 01110101011110001010, front 14 A bit is a signal with consecutive high bits
  5. Completely continuous alternating square wave refers to 10 alternate , Such as

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved