Cody

Problem 2349. Elements with highest local average

Solution 2950846

Submitted on 15 Sep 2020 by Catherine Jones
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
x = [1 2 3 4 5 6 7 8 9]; y_correct = [7 8 9]; assert(isequal(your_fcn_name(x),y_correct))

av_x = 0 2 av_x = 0 2 3 av_x = 0 2 3 4 av_x = 0 2 3 4 5 av_x = 0 2 3 4 5 6 av_x = 0 2 3 4 5 6 7 av_x = 0 2 3 4 5 6 7 8

2   Pass
x = [1 2 3]; y_correct = [1 2 3]; assert(isequal(your_fcn_name(x),y_correct))

av_x = 0 2

3   Pass
x = [0 0 0]; y_correct = [0 0 0]; assert(isequal(your_fcn_name(x),y_correct))

av_x = 0 0

4   Pass
x = [3 3 3 1 1 1 2 3 4]; y_correct = [3 3 3]; assert(isequal(your_fcn_name(x),y_correct))

av_x = 0 3 av_x = 0 3.0000 2.3333 av_x = 0 3.0000 2.3333 1.6667 av_x = 0 3.0000 2.3333 1.6667 1.0000 av_x = 0 3.0000 2.3333 1.6667 1.0000 1.3333 av_x = 0 3.0000 2.3333 1.6667 1.0000 1.3333 2.0000 av_x = 0 3.0000 2.3333 1.6667 1.0000 1.3333 2.0000 3.0000

5   Pass
x = 1000:-1:1; y_correct = [1000 999 998]; assert(isequal(your_fcn_name(x),y_correct))

av_x = 0 999 av_x = 0 999 998 av_x = 0 999 998 997 av_x = 0 999 998 997 996 av_x = 0 999 998 997 996 995 av_x = 0 999 998 997 996 995 994 av_x = 0 999 998 997 996 995 994 993 av_x = 0 999 998 997 996 995 994 993 992 av_x = 0 999 998 997 996 995 994 993 992 991 av_x = 0 999 998 997 996 995 994 993 992 991 990 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 av_x = 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Column 31 970 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 32 970 969 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 33 970 969 968 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 34 970 969 968 967 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 35 970 969 968 967 966 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 36 970 969 968 967 966 965 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 37 970 969 968 967 966 965 964 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 38 970 969 968 967 966 965 964 963 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 39 970 969 968 967 966 965 964 963 962 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 40 970 969 968 967 966 965 964 963 962 961 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 41 970 969 968 967 966 965 964 963 962 961 960 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 42 970 969 968 967 966 965 964 963 962 961 960 959 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 43 970 969 968 967 966 965 964 963 962 961 960 959 958 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 44 970 969 968 967 966 965 964 963 962 961 960 959 958 957 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 45 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 46 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 47 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 48 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 49 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 50 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 51 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 av_x = Columns 1 through 30 0 999 998 997 996 995 994 993 992 991 990 989 988 987 986 985 984 983 982 981 980 979 978 977 976 975 974 973 972 971 Columns 31 through 52 970 969 968 967 966 965 964 963 962 961 960 959 958 957 956 955 954 953 952 951 950 949 av_x = Columns 1 through 30 0 999 998 997 996 99...

Suggested Problems

More from this Author44

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!