亚马逊2013校招笔试题_第1页
亚马逊2013校招笔试题_第2页
亚马逊2013校招笔试题_第3页
亚马逊2013校招笔试题_第4页
亚马逊2013校招笔试题_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、亚马逊2013校招笔试题 Give n an array with positive in tegers and ano ther in teger for example7 2 4 9, you are required to gen erate an equati on, by insertingoperator add ( + ) and minus ( - ) among the array . The left side of equati on are con sist of the array and the right side of equati on is the in t

2、eger. here the result is 7-2+4=9 Rules: Don t in clude any space in the gen erated equati on. In case there is no way to create the equation, please output Inv alid . For example 1 1 10, output is In valid The len gth of the in teger array is from 1 to 15( in clude 1 and 15). If the len gth is 1, fo

3、r example the in put 7 7, the output is 7=7 There is no operator + or - in front of the first nu mber: Don t cha nge the order of the nu mbers. For example: 7 2 4 9. 7-2+4=9 is correct an swer, 4-2+7=9 is wrong an swer. There could be multiple in put, meaning your fun cti on could be called multiple

4、 times. Do remember print a new line after the call. Sample In put and Output: In put: 1 2 3 4 10 2 1 2 3 4 5 Output: 1+2+3+4=10 In valid Question 2 / 2 are Questi on: There is a 5*5 matrix; the elements in this matrix differe nt in teger from 0 to 24. The eleme nts in this matrix are 3 24, 15, 11,

5、12, 9 5 be disordered. 0 is a special eleme nt. The upper eleme nt, un der element, left element and right element of 0 can excha nged with 0. Such excha nge operatio ns are n amed as U , D , L and R . Operati on U means 0 excha nged with its upper eleme nt. Operati on D means 0 excha nged with its

6、un der eleme nt. Operati on L means 0 excha nged with its left eleme nt. Operati on R means 0 excha nged with its right eleme nt. For example, the origi nal matrix is 24, 4, 15, 11,9 13, 0, 22, 12, 14 23, 16, 1,2, 5 21, 17, 8, 3, 6 With the operati on seque nee URRDDL , the new matrix will be 20, 18

7、, 7, 19, 10 13, 4, 22, 2, 14 23, 16, 0, 1, 5 21, 17, 8, 3, 6 Now, we know the original matrix, the matrix after the operati ons and all the operati ons made on the orig inal matrix. Please provide the correct seque nee for the operati ons. The in put will be the orig inal matrix, the target matrix a

8、nd an operati on seque nee with wrong order. If there is a correct sequenee for this in put, then print the correct seque nee. Otherwise, print None . Rules and example: The eleme nts in the origi nal matrix are differe nt. The eleme nts in the origi nal matrix are ran dom ordered. The max len ght o

9、f operato ins is 15. If 0 is already on the boun dary, it is not possible to do further movement.for example, if 0 is in the top row, then there is no more U . The in put will be the orig inal matrix, the target matrix and an operati on seque nee with wrong order. The output will be a correct operati on seque nee. In ease there is no way to get the target matrix with

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论