2016 Ctrip test intern written programming questions

Source: Internet
Author: User

Four major questions:

The first problem, is Ctrip station has a 725*286 (specifically do not remember) advertising area, can think of test types and methods.

Write test Cases-from January 1, 2016 to March 1, 2016 the same order round trip ticket was reduced by 50 of all function points.

The second problem, the SQL statement. (The school sql--)

Third question, programming question:

There are n balls, m colors (m is less than or equal to n), if you want to take out all (m) colored balls from these n balls, at least how many you need to take.

Ideas:

I also use map to achieve, when the map of the size==m, it means that the color has been set up, calculate a minnum, and then continue to scan, update minnum

Sense of efficiency is a little low, first stick up the Code, tomorrow optimization (set the color, determine whether it must be updated minnum)

#include <iostream>#include<map>#include<vector>using namespacestd;intCollectcolor (vector<int> Balls,intM) {Map<int,int>Collect; intminnum=9999, mintemp=9999;  for(intI=0; I<balls.size (); i++) {Collect[balls[i]]=i;//map Note where each color appears recently        if(Collect.size () ==m)//the set color is no longer scanned.        {                intmaxindex=0, minindex=99999;  for(Auto J=collect.begin (); J!=collect.end (); j + +){                                if((*J) .second>maxindex) Maxindex=(*j). Second; if((*J) .second<minindex) Minindex=(*j). Second; Mintemp=maxindex-minindex+1; }                if(mintemp<minnum) Minnum=mintemp; }            }    returnMinnum;}intMain () {intarray1[]={0,1,2,6,7,4,1,1,1,1,2,6,7,2,2,0}; Vector<int> v1 (array1,array1+ -); cout<<collectcolor (v1,6) <<Endl; return 0;}

2016 Ctrip test intern written programming questions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.